From 4dc9cb7cf9d12a52bc3e664f39c559e746cc93f6 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 30 Sep 2024 17:56:37 +0300 Subject: [PATCH] tests: Remove some spurious list_timelines calls These calls seem really out of place. We know what the initial tenant and branch are in these tests, just like in all other tests. --- test_runner/regress/test_neon_cli.py | 4 +--- test_runner/regress/test_tenant_size.py | 17 +++++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/test_runner/regress/test_neon_cli.py b/test_runner/regress/test_neon_cli.py index b65430ff49..96543f1ef5 100644 --- a/test_runner/regress/test_neon_cli.py +++ b/test_runner/regress/test_neon_cli.py @@ -31,9 +31,7 @@ def helper_compare_timeline_list( ) ) - timelines_cli = env.neon_cli.list_timelines() - assert timelines_cli == env.neon_cli.list_timelines(initial_tenant) - + timelines_cli = env.neon_cli.list_timelines(initial_tenant) cli_timeline_ids = sorted([timeline_id for (_, timeline_id) in timelines_cli]) assert timelines_api == cli_timeline_ids diff --git a/test_runner/regress/test_tenant_size.py b/test_runner/regress/test_tenant_size.py index f872116a1c..609987ab0c 100644 --- a/test_runner/regress/test_tenant_size.py +++ b/test_runner/regress/test_tenant_size.py @@ -27,20 +27,15 @@ def test_empty_tenant_size(neon_env_builder: NeonEnvBuilder): env = neon_env_builder.init_configs() env.start() - (tenant_id, _) = env.neon_cli.create_tenant() + (tenant_id, timeline_id) = env.neon_cli.create_tenant() http_client = env.pageserver.http_client() initial_size = http_client.tenant_size(tenant_id) # we should never have zero, because there should be the initdb "changes" assert initial_size > 0, "initial implementation returns ~initdb tenant_size" - main_branch_name = "main" - - branch_name, main_timeline_id = env.neon_cli.list_timelines(tenant_id)[0] - assert branch_name == main_branch_name - endpoint = env.endpoints.create_start( - main_branch_name, + "main", tenant_id=tenant_id, config_lines=["autovacuum=off", "checkpoint_timeout=10min"], ) @@ -54,7 +49,7 @@ def test_empty_tenant_size(neon_env_builder: NeonEnvBuilder): # The transaction above will make the compute generate a checkpoint. # In turn, the pageserver persists the checkpoint. This should only be # one key with a size of a couple hundred bytes. - wait_for_last_flush_lsn(env, endpoint, tenant_id, main_timeline_id) + wait_for_last_flush_lsn(env, endpoint, tenant_id, timeline_id) size = http_client.tenant_size(tenant_id) assert size >= initial_size and size - initial_size < 1024 @@ -306,7 +301,8 @@ def test_single_branch_get_tenant_size_grows( env = neon_env_builder.init_start(initial_tenant_conf=tenant_config) tenant_id = env.initial_tenant - branch_name, timeline_id = env.neon_cli.list_timelines(tenant_id)[0] + timeline_id = env.initial_timeline + branch_name = "main" http_client = env.pageserver.http_client() @@ -516,7 +512,8 @@ def test_get_tenant_size_with_multiple_branches( env.pageserver.allowed_errors.append(".*InternalServerError\\(No such file or directory.*") tenant_id = env.initial_tenant - main_branch_name, main_timeline_id = env.neon_cli.list_timelines(tenant_id)[0] + main_timeline_id = env.initial_timeline + main_branch_name = "main" http_client = env.pageserver.http_client()