From 2cf98fa7e60bd6b80dd9b95aa2845f23a813ec55 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 13 Jul 2026 23:29:03 +0300 Subject: [PATCH] fix: test_kill_backgroud_writer__ok fails under load --- tests/test_testgres_common.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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