summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-09-05 15:15:25 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-09-05 15:15:25 +0200
commit1e4879adabc5fd501504038702d17b0a74371c79 (patch)
treead44669467c104295ca1fa60124b73c85a897a7c
parenteeacde18752c2cd83906532b72bcd7259f57e5ba (diff)
integration-test: Robustify test_luks_forced_removal()
Wait a bit for the object path to disappear after yanking the device away. Also, ensure that the device is always re-added after this, even if there are test failures or exceptions in between, otherwise all subsequent tests will fail as well.
-rwxr-xr-xsrc/tests/integration-test16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tests/integration-test b/src/tests/integration-test
index 8b9343b..e585121 100755
--- a/src/tests/integration-test
+++ b/src/tests/integration-test
@@ -1132,12 +1132,20 @@ class Luks(UDisksTestCase):
self.assertTrue(mount_path.endswith('treasure'))
# removal should clean up mounts
- self.remove_device(self.device)
- self.assertFalse(os.path.exists(mount_path))
- self.assertEqual(self.client.get_object(path), None)
+ try:
+ self.remove_device(self.device)
+ self.assertFalse(os.path.exists(mount_path))
+ timeout = 50
+ while timeout > 0:
+ if self.client.get_object(path) is None:
+ break
+ timeout -= 1
+ time.sleep(0.1)
+ self.assertGreater(timeout, 0, 'timeout waiting for object path %s to disappear' % path)
+ finally:
+ self.readd_devices()
# after putting it back, it should be mountable again
- self.readd_devices()
crypt_obj = self.client.get_object(self.udisks_block().get_object_path())
path = crypt_obj.get_property('encrypted').call_unlock_sync('s3kr1t',
no_options, None)