refactor: remove misleading log messages and redundant asserts from test_pageserver_with_empty_tenants

At least since commit 'Return broken tenants due to non existing timelines dir (#2552) (#2575)'
some of these messages are wrong.
This commit is contained in:
Christian Schwarz
2022-11-16 07:57:51 -05:00
committed by Dmitry Rodionov
parent b8488e70a9
commit 8aed805933

View File

@@ -223,15 +223,9 @@ def test_pageserver_with_empty_tenants(
client = env.pageserver.http_client()
tenant_without_timelines_dir = env.initial_tenant
log.info(
f"Tenant {tenant_without_timelines_dir} becomes broken: it abnormally looses tenants/ directory and is expected to be completely ignored when pageserver restarts"
)
shutil.rmtree(Path(env.repo_dir) / "tenants" / str(tenant_without_timelines_dir) / "timelines")
tenant_with_empty_timelines_dir = client.tenant_create()
log.info(
f"Tenant {tenant_with_empty_timelines_dir} gets all of its timelines deleted: still should be functional"
)
temp_timelines = client.timeline_list(tenant_with_empty_timelines_dir)
for temp_timeline in temp_timelines:
client.timeline_delete(
@@ -255,22 +249,14 @@ def test_pageserver_with_empty_tenants(
client = env.pageserver.http_client()
tenants = client.tenant_list()
assert (
len(tenants) == 2
), "Pageserver should attach only tenants with empty or not existing timelines/ dir on restart"
assert len(tenants) == 2
[broken_tenant] = [t for t in tenants if t["id"] == str(tenant_without_timelines_dir)]
assert (
broken_tenant
), f"A broken tenant {tenant_without_timelines_dir} should exists in the tenant list"
assert (
broken_tenant["state"] == "Broken"
), f"Tenant {tenant_without_timelines_dir} without timelines dir should be broken"
[loaded_tenant] = [t for t in tenants if t["id"] == str(tenant_with_empty_timelines_dir)]
assert (
loaded_tenant
), f"Tenant {tenant_with_empty_timelines_dir} should be loaded as the only one with tenants/ directory"
assert loaded_tenant["state"] == {
"Active": {"background_jobs_running": False}
}, "Empty tenant should be loaded and ready for timeline creation"
}, "Tenant {tenant_with_empty_timelines_dir} with empty timelines dir should be active and ready for timeline creation"