diff --git a/test_runner/regress/test_remote_storage.py b/test_runner/regress/test_remote_storage.py index 0a02a80de5..56b14dc42b 100644 --- a/test_runner/regress/test_remote_storage.py +++ b/test_runner/regress/test_remote_storage.py @@ -10,8 +10,8 @@ import pytest from fixtures.log_helper import log from fixtures.neon_fixtures import ( NeonEnvBuilder, - NeonPageserverHttpClient, RemoteStorageKind, + assert_no_in_progress_downloads_for_tenant, available_remote_storages, wait_for_last_record_lsn, wait_for_upload, @@ -125,7 +125,7 @@ def test_remote_storage_backup_and_restore( wait_until( number_of_iterations=20, interval=1, - func=lambda: expect_tenant_to_download_timeline(client, tenant_id), + func=lambda: assert_no_in_progress_downloads_for_tenant(client, tenant_id), ) detail = client.timeline_detail(tenant_id, timeline_id) @@ -142,16 +142,3 @@ def test_remote_storage_backup_and_restore( query_scalar(cur, f"SELECT secret FROM t{checkpoint_number} WHERE id = {data_id};") == f"{data_secret}|{checkpoint_number}" ) - - -def expect_tenant_to_download_timeline( - client: NeonPageserverHttpClient, - tenant_id: TenantId, -): - for tenant in client.tenant_list(): - if tenant["id"] == str(tenant_id): - assert not tenant.get( - "has_in_progress_downloads", True - ), f"Tenant {tenant_id} should have no downloads in progress" - return - assert False, f"Tenant {tenant_id} is missing on pageserver" diff --git a/test_runner/regress/test_tenants_with_remote_storage.py b/test_runner/regress/test_tenants_with_remote_storage.py index a7c2e7ace0..96c1fc25db 100644 --- a/test_runner/regress/test_tenants_with_remote_storage.py +++ b/test_runner/regress/test_tenants_with_remote_storage.py @@ -19,9 +19,9 @@ from fixtures.neon_fixtures import ( LocalFsStorage, NeonEnv, NeonEnvBuilder, - NeonPageserverHttpClient, Postgres, RemoteStorageKind, + assert_no_in_progress_downloads_for_tenant, available_remote_storages, wait_for_last_record_lsn, wait_for_upload, @@ -168,7 +168,7 @@ def test_tenants_attached_after_download( wait_until( number_of_iterations=5, interval=1, - func=lambda: expect_tenant_to_download_timeline(client, tenant_id), + func=lambda: assert_no_in_progress_downloads_for_tenant(client, tenant_id), ) restored_timelines = client.timeline_list(tenant_id) @@ -181,19 +181,6 @@ def test_tenants_attached_after_download( ), f"Tenant {tenant_id} should have its old timeline {timeline_id} restored from the remote storage" -def expect_tenant_to_download_timeline( - client: NeonPageserverHttpClient, - tenant_id: TenantId, -): - for tenant in client.tenant_list(): - if tenant["id"] == str(tenant_id): - assert not tenant.get( - "has_in_progress_downloads", True - ), f"Tenant {tenant_id} should have no downloads in progress" - return - assert False, f"Tenant {tenant_id} is missing on pageserver" - - @pytest.mark.parametrize("remote_storage_kind", [RemoteStorageKind.LOCAL_FS]) def test_tenant_upgrades_index_json_from_v0( neon_env_builder: NeonEnvBuilder, remote_storage_kind: RemoteStorageKind @@ -262,7 +249,7 @@ def test_tenant_upgrades_index_json_from_v0( wait_until( number_of_iterations=5, interval=1, - func=lambda: expect_tenant_to_download_timeline(pageserver_http, tenant_id), + func=lambda: assert_no_in_progress_downloads_for_tenant(pageserver_http, tenant_id), ) pg = env.postgres.create_start("main") @@ -371,7 +358,7 @@ def test_tenant_redownloads_truncated_file_on_startup( wait_until( number_of_iterations=5, interval=1, - func=lambda: expect_tenant_to_download_timeline(client, tenant_id), + func=lambda: assert_no_in_progress_downloads_for_tenant(client, tenant_id), ) restored_timelines = client.timeline_list(tenant_id)