Skip to content

Commit 2cf98fa

Browse files
fix: test_kill_backgroud_writer__ok fails under load
1 parent 852f69e commit 2cf98fa

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/test_testgres_common.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,25 @@ def test_kill_backgroud_writer__ok(
754754
assert node.is_started
755755
node_pid = node.pid
756756
assert type(node_pid) is int
757+
758+
# --- We expect BackgroundWriter to appear under load ------------------------
759+
bw_attempt = 0
760+
while True:
761+
aux_pids = node.auxiliary_pids
762+
assert type(aux_pids) is dict
763+
764+
if ProcessType.BackgroundWriter in aux_pids:
765+
break
766+
767+
bw_attempt += 1
768+
# We give the server up to 3 seconds to start all background workers.
769+
if bw_attempt == 30:
770+
raise RuntimeError("BackgroundWriter process did not start in time under heavy load.")
771+
772+
time.sleep(0.1)
773+
continue
774+
775+
# ----------------------------------------------------------------------------
757776
aux_pids = node.auxiliary_pids
758777
assert type(aux_pids) is dict
759778
assert ProcessType.BackgroundWriter in aux_pids

0 commit comments

Comments
 (0)