mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
test: the watchdog test must not inherit a sibling's shutdown state
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:
parent
c161f306cf
commit
e5e1916129
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue