From d013a2b2279a5217b3b27009e74135f57280e775 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 15 Nov 2022 18:41:45 +0200 Subject: [PATCH] Make test_gc_cutoff test more robust. Previously, if the failpoint was not reached for some reason, the test would only fail because it would reach the 5 minute timeout we have on all python tests. That's very subtle. Make it fail explicitly, if the failpoint is not hit on each iteration of the loop. Extracted from a larger PR, see https://github.com/neondatabase/neon/pull/2785/files#r1022765794 --- test_runner/regress/test_gc_cutoff.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test_runner/regress/test_gc_cutoff.py b/test_runner/regress/test_gc_cutoff.py index 7fe77a7e85..f760c993f4 100644 --- a/test_runner/regress/test_gc_cutoff.py +++ b/test_runner/regress/test_gc_cutoff.py @@ -1,3 +1,4 @@ +import pytest from fixtures.neon_fixtures import NeonEnvBuilder, PgBin @@ -35,10 +36,9 @@ def test_gc_cutoff(neon_env_builder: NeonEnvBuilder, pg_bin: PgBin): pageserver_http.configure_failpoints(("after-timeline-gc-removed-layers", "exit")) - for i in range(5): - try: + for _ in range(5): + with pytest.raises(Exception): pg_bin.run_capture(["pgbench", "-N", "-c5", "-T100", "-Mprepared", connstr]) - except Exception: - env.pageserver.stop() - env.pageserver.start() - pageserver_http.configure_failpoints(("after-timeline-gc-removed-layers", "exit")) + env.pageserver.stop() + env.pageserver.start() + pageserver_http.configure_failpoints(("after-timeline-gc-removed-layers", "exit"))