fix(tests): align stale tests with current behavior

- swarm/test_swarm_api, swarm/test_heartbeat: replace deprecated
  asyncio.get_event_loop().run_until_complete() with asyncio.run();
  the former raises in 3.11 once another test has set+closed a loop on
  the main thread.
- prober/test_prober_bus, prober/test_prober_worker: extend tcp_fingerprint
  mocks with tos/dscp/ecn/server_isn so the worker doesn't KeyError into
  the prober_error branch.
- services/test_service_isolation: collector now retries on event-stream
  errors instead of exiting; assert it stays running and cancel cleanly.
- live/test_imap_live, live/test_pop3_live: log format emits
  outcome="failure", not "failed".
- live/test_service_isolation_live: is_service_container accepts label
  OR state-name; rewrite the empty-state test against a synthetic
  unlabeled container instead of the host's real fleet.
This commit is contained in:
2026-04-28 00:44:40 -04:00
parent 8344b539c8
commit 6b407e8c9c
8 changed files with 36 additions and 23 deletions

View File

@@ -167,7 +167,7 @@ def test_heartbeat_happy_path_primary_extraction(
assert s["archetype"] == "generic"
assert s["service_config"] == {"ssh": {"port": 22}}
asyncio.get_event_loop().run_until_complete(_verify())
asyncio.run(_verify())
def test_heartbeat_fallback_extraction_path_also_accepted(
@@ -241,7 +241,7 @@ def test_heartbeat_decommissioned_host_returns_404(
ok = await repo.delete_swarm_host(host["host_uuid"])
assert ok
asyncio.get_event_loop().run_until_complete(_delete())
asyncio.run(_delete())
_pin_fingerprint(monkeypatch, fp)
resp = client.post(
@@ -272,7 +272,7 @@ def test_heartbeat_deployed_false_bumps_host_but_writes_no_shards(
shards = await repo.list_decky_shards(host["host_uuid"])
assert shards == []
asyncio.get_event_loop().run_until_complete(_verify())
asyncio.run(_verify())
def test_heartbeat_decky_missing_from_runtime_is_degraded(
@@ -297,4 +297,4 @@ def test_heartbeat_decky_missing_from_runtime_is_degraded(
assert by["decky-01"]["state"] == "running"
assert by["decky-02"]["state"] == "degraded"
asyncio.get_event_loop().run_until_complete(_verify())
asyncio.run(_verify())

View File

@@ -464,7 +464,7 @@ def test_list_deckies_joins_host_identity(client: TestClient, repo) -> None:
"services": ["smb", "ssh"], "state": "failed", "last_error": "boom",
})
asyncio.get_event_loop().run_until_complete(_seed())
asyncio.run(_seed())
rows = client.get("/swarm/deckies").json()
assert len(rows) == 2