mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-28 10:30:40 +00:00
test_runner: improve wait_until (#9936)
Improves `wait_until` by: * Use `timeout` instead of `iterations`. This allows changing the timeout/interval parameters independently. * Make `timeout` and `interval` optional (default 20s and 0.5s). Most callers don't care. * Only output status every 1s by default, and add optional `status_interval` parameter. * Remove `show_intermediate_error`, this was always emitted anyway. Most callers have been updated to use the defaults, except where they had good reason otherwise.
This commit is contained in:
committed by
Ivan Efremov
parent
7fc2912d06
commit
0e1a336607
@@ -137,7 +137,7 @@ def test_branch_creation_many(neon_compare: NeonCompare, n_branches: int, shape:
|
||||
startup_line = "INFO version: git(-env)?:"
|
||||
|
||||
# find the first line of the log file so we can find the next start later
|
||||
_, first_start = wait_until(5, 1, lambda: env.pageserver.assert_log_contains(startup_line))
|
||||
_, first_start = wait_until(lambda: env.pageserver.assert_log_contains(startup_line))
|
||||
|
||||
# start without gc so we can time compaction with less noise; use shorter
|
||||
# period for compaction so it starts earlier
|
||||
@@ -156,7 +156,7 @@ def test_branch_creation_many(neon_compare: NeonCompare, n_branches: int, shape:
|
||||
)
|
||||
|
||||
_, second_start = wait_until(
|
||||
5, 1, lambda: env.pageserver.assert_log_contains(startup_line, first_start)
|
||||
lambda: env.pageserver.assert_log_contains(startup_line, first_start),
|
||||
)
|
||||
env.pageserver.quiesce_tenants()
|
||||
|
||||
@@ -164,8 +164,6 @@ def test_branch_creation_many(neon_compare: NeonCompare, n_branches: int, shape:
|
||||
|
||||
# wait for compaction to complete, which most likely has already done so multiple times
|
||||
msg, _ = wait_until(
|
||||
30,
|
||||
1,
|
||||
lambda: env.pageserver.assert_log_contains(
|
||||
f".*tenant_id={env.initial_tenant}.*: compaction iteration complete.*", second_start
|
||||
),
|
||||
@@ -205,7 +203,7 @@ def wait_and_record_startup_metrics(
|
||||
assert len(matching) == len(expected_labels)
|
||||
return matching
|
||||
|
||||
samples = wait_until(10, 1, metrics_are_filled)
|
||||
samples = wait_until(metrics_are_filled)
|
||||
|
||||
for sample in samples:
|
||||
phase = sample.labels["phase"]
|
||||
|
||||
Reference in New Issue
Block a user