[evolution-data-server/gnome-3-30] [test-server-utils] Correct when open of deprecated book/calendar is retried



commit a14049cc48856f3b11df5000970d4dfdd80c583a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 3 17:27:28 2018 +0100

    [test-server-utils] Correct when open of deprecated book/calendar is retried
    
    The test could fail when creating the instance, not when opening it,
    thus retry also when the instance creation fails. Left the code
    for the open() too, just in case.

 tests/test-server-utils/e-test-server-utils.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index 9276edb11..09a00bee1 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -446,8 +446,15 @@ e_test_server_utils_source_added (ESourceRegistry *registry,
 
                /* Dont bother testing the Async apis for deprecated APIs */
                pair->fixture->service.book = e_book_new (source, &error);
-               if (!pair->fixture->service.book)
-                       g_error ("Unable to create the test book: %s", error->message);
+               if (!pair->fixture->service.book) {
+                       if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+                           pair->retries < 3)
+                               need_retry = TRUE;
+                       else
+                               g_error ("Unable to create the test book: %s", error->message);
+
+                       break;
+               }
 
                if (!e_book_open (pair->fixture->service.book, FALSE, &error)) {
                        if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
@@ -487,8 +494,14 @@ e_test_server_utils_source_added (ESourceRegistry *registry,
 
                /* Dont bother testing the Async apis for deprecated APIs */
                pair->fixture->service.calendar = e_cal_new (source, pair->closure->calendar_source_type);
-               if (!pair->fixture->service.calendar)
-                       g_error ("Unable to create the test calendar");
+               if (!pair->fixture->service.calendar) {
+                       if (pair->retries < 3)
+                               need_retry = TRUE;
+                       else
+                               g_error ("Unable to create the test calendar");
+
+                       break;
+               }
 
                if (!e_cal_open (pair->fixture->service.calendar, FALSE, &error)) {
                        if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]