diff --git a/tests/test_testgres_common.py b/tests/test_testgres_common.py index 9be4a778..ddf1b09b 100644 --- a/tests/test_testgres_common.py +++ b/tests/test_testgres_common.py @@ -754,6 +754,25 @@ def test_kill_backgroud_writer__ok( assert node.is_started node_pid = node.pid assert type(node_pid) is int + + # --- We expect BackgroundWriter to appear under load ------------------------ + bw_attempt = 0 + while True: + aux_pids = node.auxiliary_pids + assert type(aux_pids) is dict + + if ProcessType.BackgroundWriter in aux_pids: + break + + bw_attempt += 1 + # We give the server up to 3 seconds to start all background workers. + if bw_attempt == 30: + raise RuntimeError("BackgroundWriter process did not start in time under heavy load.") + + time.sleep(0.1) + continue + + # ---------------------------------------------------------------------------- aux_pids = node.auxiliary_pids assert type(aux_pids) is dict assert ProcessType.BackgroundWriter in aux_pids