[libgdata/offline-testing] tests: Work around distributed system bugs in the Google Contacts servers



commit 2bbfff087d22b507bb6100977cc72ab583f39d73
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Jul 31 09:08:42 2013 +0200

    tests: Work around distributed system bugs in the Google Contacts servers
    
    Looks like the servers have changed to use weak synchronisation of new
    contacts, so querying for contacts immediately after adding them now
    often won’t return the new ones, or will return them with outdated IDs.
    ‘Fix’ this by adding a mandatory sleep after creating the contacts, and
    before querying them for the first time.

 gdata/tests/contacts.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index c9afdcd..1148e49 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -179,6 +179,12 @@ set_up_query_all_contacts (QueryAllContactsData *data, gconstpointer service)
        g_object_unref (contact);
 
        gdata_mock_server_end_trace (mock_server);
+
+       /* It takes a few seconds for the contacts to reliably propagate around Google's servers. Distributed 
systems are so fun. Not.
+        * Thankfully, we don't have to wait when running against the mock server. */
+       if (gdata_mock_server_get_enable_online (mock_server) == TRUE) {
+               g_usleep (G_USEC_PER_SEC * 5);
+       }
 }
 
 static void


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