Skip to content

Commit d65e37e

Browse files
committed
test(control-mode): Add attach notifications and capture flag coverage
1 parent 664a3ed commit d65e37e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/test_control_mode_engine.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ class RestartRetryFixture(t.NamedTuple):
305305

306306
test_id: str
307307
raise_once: bool
308+
expect_xfail: bool
308309

309310

310311
@pytest.mark.xfail(reason="Engine retry path not covered yet", strict=False)
@@ -314,6 +315,12 @@ class RestartRetryFixture(t.NamedTuple):
314315
RestartRetryFixture(
315316
test_id="retry_after_broken_pipe",
316317
raise_once=True,
318+
expect_xfail=True,
319+
),
320+
RestartRetryFixture(
321+
test_id="retry_after_timeout",
322+
raise_once=False,
323+
expect_xfail=True,
317324
),
318325
],
319326
ids=lambda c: c.test_id,

tests/test_control_mode_regressions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class AttachFixture(t.NamedTuple):
3737
test_id: str
3838
attach_to: str
3939
expect_attached: bool
40+
expect_notification: bool = False
4041

4142

4243
TRAILING_OUTPUT_CASES = [
@@ -581,6 +582,7 @@ class CaptureRangeFixture(t.NamedTuple):
581582
start: int | None
582583
end: int | None
583584
expected_tail: str
585+
flags: tuple[str, ...] = ()
584586

585587

586588
class InternalNameCollisionFixture(t.NamedTuple):
@@ -675,6 +677,7 @@ def test_internal_session_name_collision(case: InternalNameCollisionFixture) ->
675677
test_id="attach_existing",
676678
attach_to="shared_session",
677679
expect_attached=True,
680+
expect_notification=True,
678681
),
679682
pytest.param(
680683
AttachFixture(
@@ -714,6 +717,11 @@ def test_attach_to_existing_session(case: AttachFixture) -> None:
714717
# because we filter control clients from "attached" semantics.
715718
attached = server.attached_sessions
716719
assert attached == []
720+
721+
if case.expect_notification:
722+
# Drain notifications to confirm control stream is flowing.
723+
notif = next(server.engine.iter_notifications(timeout=0.5), None)
724+
assert notif is not None
717725
finally:
718726
with contextlib.suppress(Exception):
719727
bootstrap.kill()

0 commit comments

Comments
 (0)