[evolution-data-server/gnome-3-32] Add workaround for D-Bus property change into get-revision tests



commit bbefb8044d7b3826a9ac64dd04a43b8b38db427a
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 23 20:56:00 2019 +0200

    Add workaround for D-Bus property change into get-revision tests
    
    Even with the previous commit there still could happen some issue
    with D-Bus property change notifications, thus add a workaround to
    the related book and calendar tests, because it's not a problem
    on the evolution-data-server side, but somewhere deeper.

 tests/libebook/client/test-book-client-get-revision.c | 13 +++++++++++++
 tests/libecal/client/test-cal-client-get-revision.c   | 13 +++++++++++++
 2 files changed, 26 insertions(+)
---
diff --git a/tests/libebook/client/test-book-client-get-revision.c 
b/tests/libebook/client/test-book-client-get-revision.c
index 8995f0659..4cb7a13d0 100644
--- a/tests/libebook/client/test-book-client-get-revision.c
+++ b/tests/libebook/client/test-book-client-get-revision.c
@@ -48,6 +48,19 @@ get_revision_compare_cycle (EBookClient *client)
        if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, 
&revision_after, NULL, &error))
                g_error ("Error getting book revision: %s", error->message);
 
+       /* Sometimes, kind of rarely, the D-Bus property change is not delivered on time,
+          thus give it some time to be received and processed. */
+       if (g_strcmp0 (revision_before, revision_after) == 0) {
+               g_message ("   D-Bus property 'revision' change not received yet, trying to wait a bit");
+
+               g_usleep (G_USEC_PER_SEC / 2);
+
+               g_clear_pointer (&revision_after, g_free);
+
+               if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, 
&revision_after, NULL, &error))
+                       g_error ("Error getting book revision: %s", error->message);
+       }
+
        g_assert (revision_before);
        g_assert (revision_after);
        g_assert_cmpstr (revision_before, !=, revision_after);
diff --git a/tests/libecal/client/test-cal-client-get-revision.c 
b/tests/libecal/client/test-cal-client-get-revision.c
index 96887a360..464bbdeeb 100644
--- a/tests/libecal/client/test-cal-client-get-revision.c
+++ b/tests/libecal/client/test-cal-client-get-revision.c
@@ -54,6 +54,19 @@ get_revision_compare_cycle (ECalClient *client)
                                                &revision_after, NULL, &error))
                g_error ("Error getting calendar revision: %s", error->message);
 
+       /* Sometimes, kind of rarely, the D-Bus property change is not delivered on time,
+          thus give it some time to be received and processed. */
+       if (g_strcmp0 (revision_before, revision_after) == 0) {
+               g_message ("   D-Bus property 'revision' change not received yet, trying to wait a bit");
+
+               g_usleep (G_USEC_PER_SEC / 2);
+
+               g_clear_pointer (&revision_after, g_free);
+
+               if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, 
&revision_after, NULL, &error))
+                       g_error ("Error getting calendar revision: %s", error->message);
+       }
+
        g_assert (revision_before);
        g_assert (revision_after);
        g_assert_cmpstr (revision_before, !=, revision_after);


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