Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements to test infrastructure #3455

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/client-dbus/tests/udev/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down
9 changes: 3 additions & 6 deletions tests/client-dbus/tests/udev/test_udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,9 @@ 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)

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))

if take_down_dm:
remove_stratis_dm_devices()
Expand Down Expand Up @@ -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()

Expand Down