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:
@@ -16,6 +16,7 @@ worker degrades gracefully while unrelated workers remain unaffected.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
@@ -68,8 +69,12 @@ class TestCollectorIsolation:
|
||||
with patch("decnet.config.load_state", return_value=None):
|
||||
task = asyncio.create_task(log_collector_worker("/tmp/decnet-test-collector.log"))
|
||||
await asyncio.sleep(0.1)
|
||||
assert task.done()
|
||||
assert task.exception() is None
|
||||
# Collector now retries on event-stream errors instead of
|
||||
# exiting; it should still be running (i.e. surviving) here.
|
||||
assert not task.done()
|
||||
task.cancel()
|
||||
with contextlib.suppress(asyncio.CancelledError):
|
||||
await task
|
||||
|
||||
def test_collector_container_filter_with_unknown_containers(self):
|
||||
"""is_service_container must reject containers not in state."""
|
||||
|
||||
Reference in New Issue
Block a user