From e85547956e71a2a9e98a5d8ecbc439ce31be8c98 Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov Date: Mon, 10 Apr 2023 16:28:14 +0300 Subject: [PATCH] tests: improve assert, change wording --- test_runner/regress/test_remote_storage.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/test_runner/regress/test_remote_storage.py b/test_runner/regress/test_remote_storage.py index c853c0a40b..7d41d464df 100644 --- a/test_runner/regress/test_remote_storage.py +++ b/test_runner/regress/test_remote_storage.py @@ -822,24 +822,21 @@ def test_timeline_resurrection_on_attach( shutil.rmtree(dir_to_clear) os.mkdir(dir_to_clear) - ##### Second start, restore the data and ensure it's the same + ##### Second start, restore the data and ensure that we see only timeline that wasnt deleted env.pageserver.start() client.tenant_attach(tenant_id=tenant_id) - def tenant_active(): - all_states = client.tenant_list() - [tenant] = [t for t in all_states if TenantId(t["id"]) == tenant_id] - assert tenant["state"] == "Active" - - wait_until( - number_of_iterations=5, - interval=1, - func=tenant_active, - ) + wait_until_tenant_active(client, tenant_id=tenant_id, iterations=5) timelines = client.timeline_list(tenant_id=tenant_id) - assert len(timelines) == 1 + assert len(timelines) == 1, f"Expected to see only one non deleted timeline, got {timelines}" + timeline = timelines.pop() + loaded_timeline_id = timeline["timeline_id"] + assert ( + TimelineId(loaded_timeline_id) == timeline_id + ), f"expected to load only {timeline_id} but got {loaded_timeline_id}" + assert timeline["state"] == "Active" # TODO Test that we correctly handle GC of files that are stuck in upload queue.