From 934c3957da057a4a6ad508b830d7a72496041af1 Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 26 Sep 2023 13:32:05 -0400 Subject: [PATCH 1/3] Wait for the pool immediately after creation Get the pool's UUID after the pool has appeared. Signed-off-by: mulhern --- tests/client-dbus/tests/udev/test_udev.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/client-dbus/tests/udev/test_udev.py b/tests/client-dbus/tests/udev/test_udev.py index dcfd02cce2..c5bacd547a 100644 --- a/tests/client-dbus/tests/udev/test_udev.py +++ b/tests/client-dbus/tests/udev/test_udev.py @@ -254,10 +254,8 @@ def _simple_initial_discovery_test( (_, (pool_object_path, device_object_paths)) = create_pool( random_string(5), devnodes, key_description=key_description ) - pool_uuid = Pool.Properties.Uuid.Get(get_object(pool_object_path)) - self.wait_for_pools(1) - + pool_uuid = Pool.Properties.Uuid.Get(get_object(pool_object_path)) wait_for_udev(STRATIS_FS_TYPE, get_devnodes(device_object_paths)) if take_down_dm: @@ -345,9 +343,8 @@ def _simple_event_test(self, *, key_spec=None): # pylint: disable=too-many-loca (_, (pool_object_path, _)) = create_pool( random_string(5), devnodes, key_description=key_description ) - pool_uuid = Pool.Properties.Uuid.Get(get_object(pool_object_path)) - self.wait_for_pools(1) + pool_uuid = Pool.Properties.Uuid.Get(get_object(pool_object_path)) remove_stratis_dm_devices() From da10ed2b6f49ed4678588802e064c679de320770 Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 26 Sep 2023 15:10:34 -0400 Subject: [PATCH 2/3] Wait for udev before waiting for pools Signed-off-by: mulhern --- tests/client-dbus/tests/udev/test_udev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client-dbus/tests/udev/test_udev.py b/tests/client-dbus/tests/udev/test_udev.py index c5bacd547a..0bb3685041 100644 --- a/tests/client-dbus/tests/udev/test_udev.py +++ b/tests/client-dbus/tests/udev/test_udev.py @@ -254,9 +254,9 @@ def _simple_initial_discovery_test( (_, (pool_object_path, device_object_paths)) = create_pool( random_string(5), devnodes, key_description=key_description ) + wait_for_udev(STRATIS_FS_TYPE, get_devnodes(device_object_paths)) self.wait_for_pools(1) pool_uuid = Pool.Properties.Uuid.Get(get_object(pool_object_path)) - wait_for_udev(STRATIS_FS_TYPE, get_devnodes(device_object_paths)) if take_down_dm: remove_stratis_dm_devices() From 7fe49204ac54227e4bd68bc699f82c657009a26d Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 26 Sep 2023 15:32:29 -0400 Subject: [PATCH 3/3] Be yet more verbose on test_generic error Signed-off-by: mulhern --- tests/client-dbus/tests/udev/_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/client-dbus/tests/udev/_utils.py b/tests/client-dbus/tests/udev/_utils.py index 289a0595fd..fed1114d59 100644 --- a/tests/client-dbus/tests/udev/_utils.py +++ b/tests/client-dbus/tests/udev/_utils.py @@ -449,12 +449,13 @@ def wait_for_pools(self, expected_num, *, name=None): :return: list of pool information found :rtype: list of (str * MOPool) """ - (count, limit, dbus_err, found_num, known_pools) = ( + (count, limit, dbus_err, found_num, known_pools, start_time) = ( 0, expected_num + 1, None, None, None, + time.time(), ) while count < limit and not expected_num == found_num: try: @@ -469,7 +470,10 @@ def wait_for_pools(self, expected_num, *, name=None): count += 1 if found_num is None and dbus_err is not None: - raise dbus_err + raise RuntimeError( + f"After {time.time() - start_time:.2f} seconds, the only " + "response is a D-Bus exception" + ) from dbus_err self.assertEqual(found_num, expected_num)