From 3f93c6c6f0840b3315a70368ef2e807a0634b81c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 16 Nov 2022 10:08:36 +0200 Subject: [PATCH] Improve checks for broken tenants in test_broken_timeline.py - Refactor the code a little bit, removing the silly for-loop over a single element. - Make it more clear in log messages that the errors are expectd - Check for a more precise error message "Failed to load delta layer" instead of just "extracting base backup failed". --- test_runner/regress/test_broken_timeline.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test_runner/regress/test_broken_timeline.py b/test_runner/regress/test_broken_timeline.py index cf7f4b8289..5abf0967f2 100644 --- a/test_runner/regress/test_broken_timeline.py +++ b/test_runner/regress/test_broken_timeline.py @@ -79,23 +79,24 @@ def test_broken_timeline(neon_env_builder: NeonEnvBuilder): # First timeline would not get loaded into pageserver due to corrupt metadata file with pytest.raises(Exception, match=f"Timeline {tenant1}/{timeline1} was not found") as err: pg1.start() - log.info(f"compute startup failed eagerly for timeline with corrupt metadata: {err}") + log.info( + f"As expected, compute startup failed eagerly for timeline with corrupt metadata: {err}" + ) # Second timeline has no ancestors, only the metadata file and no layer files # We don't have the remote storage enabled, which means timeline is in an incorrect state, # it's not loaded at all with pytest.raises(Exception, match=f"Timeline {tenant2}/{timeline2} was not found") as err: pg2.start() - log.info(f"compute startup failed eagerly for timeline with corrupt metadata: {err}") + log.info(f"As expected, compute startup failed for timeline with missing layers: {err}") - # Yet other timelines will fail when their layers will be queried during basebackup: we don't check layer file contents on startup, when loading the timeline - for n in range(3, 4): - (bad_tenant, bad_timeline, pg) = tenant_timelines[n] - with pytest.raises(Exception, match="extracting base backup failed") as err: - pg.start() - log.info( - f"compute startup failed lazily for timeline {bad_tenant}/{bad_timeline} with corrupt layers, during basebackup preparation: {err}" - ) + # Third timeline will also fail during basebackup, because the layer file is corrupt. + # (We don't check layer file contents on startup, when loading the timeline) + with pytest.raises(Exception, match="Failed to load delta layer") as err: + pg3.start() + log.info( + f"As expected, compute startup failed for timeline {tenant3}/{timeline3} with corrupt layers: {err}" + ) def test_create_multiple_timelines_parallel(neon_simple_env: NeonEnv):