test: the watchdog test must not inherit a sibling's shutdown state
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

perpetual_shutdown is set by the real before_server_stop listener, so any
earlier async_client teardown in the same pytest-xdist worker leaves it
True on the module-global app and the watchdog returns before reclaiming.
Failed under -nauto, passed alone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-19 19:09:16 -06:00
parent c161f306cf
commit e5e1916129
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -180,6 +180,12 @@ async def test_watchdog_reclaims_and_starts_pumps_when_owner_is_dead(async_clien
async def fake_dispatch(event):
dispatched.append(event)
# A sibling test's async_client teardown runs the real before_server_stop listener,
# which leaves perpetual_shutdown=True on the module-global app; the watchdog would
# then return before reclaiming. This test is about a dead owner, not shutdown.
monkeypatch.setattr(api_app.ctx, 'perpetual_shutdown', False, raising=False)
monkeypatch.setattr(api_app.state, 'is_stopping', False, raising=False)
api_app.shared_ctx.perpetual_tasks_started.set()
api_app.shared_ctx.perpetual_tasks_owner_pid.value = 2**31 - 1
monkeypatch.setattr('wrolpi.api_utils._dispatch_perpetual', fake_dispatch)