integration-test: Fix occasional failure of test_luks_forced_removal
authorMartin Pitt <martinpitt@gnome.org>
Thu, 6 Sep 2012 08:17:47 +0000 (10:17 +0200)
committerMartin Pitt <martinpitt@gnome.org>
Thu, 6 Sep 2012 08:17:47 +0000 (10:17 +0200)
Sometimes the client's GDBusObjectManager does not refresh properly and keeps
around objects which have long gone, which leads to a timeout in waiting for
the device object to disappear. Presumably this is because the test suite does
not run a main loop, and we cannot currently access
g_main_context_get_default() from introspection. So instead, just generate a
fresh client.

src/tests/integration-test

index e585121..5e30888 100755 (executable)
@@ -1140,6 +1140,10 @@ class Luks(UDisksTestCase):
                     if self.client.get_object(path) is None:
                         break
                     timeout -= 1
+                    # we do not have a main loop, and cannot currently use
+                    # g_main_context_get_default() from introspection, so
+                    # instead of refreshing self.client, get a new one
+                    self.client = UDisks.Client.new_sync(None)
                     time.sleep(0.1)
                 self.assertGreater(timeout, 0, 'timeout waiting for object path %s to disappear' % path)
             finally: