Skip to content

test(linux): SNI sender thread lifecycle + outgoing queue drain (#2)#8

Merged
Kitty-Hivens merged 1 commit into
mainfrom
test/sni-sender-lifecycle
May 29, 2026
Merged

test(linux): SNI sender thread lifecycle + outgoing queue drain (#2)#8
Kitty-Hivens merged 1 commit into
mainfrom
test/sni-sender-lifecycle

Conversation

@Kitty-Hivens

Copy link
Copy Markdown
Owner

Summary

Issue #2: mock-first test coverage for the Linux SNI backend's
off-caller-thread sender (e5e6b5f), no session bus required.

DBusBindings is rebuilt with recording MethodHandles and messages are
enqueued as recognizable zero-length segments straight into the outgoing
queue, so the sender's drain / lifecycle is asserted deterministically.

Covers the issue's "what to cover" list:

  • close() with nothing queued: sender exits within the poll timeout,
    connection unref'd exactly once.
  • FIFO drain: each queued message is sent, flushed, and unref'd in
    submission order.
  • close() mid-flush: the in-flight send/flush/unref triplet completes
    (the sender is not interrupted), then the still-queued messages are
    drained by unref WITHOUT sending.
  • concurrent emit from many threads: nothing dropped/duplicated,
    per-thread submission order preserved on the wire.

Seam: SniTrayImpl + DBusBindings constructors and SniTrayImpl.outgoing
go private -> internal so the test source set can drive them. No public
API change.

Out of scope: the optional real-session-bus smoke (gated on
DBUS_SESSION_BUS_ADDRESS, CI-skipped) is not included.

Closes #2

Test plan

  • ./gradlew test green -- 15 tests (4 new sender tests + existing 11), 0 failures

…#2)

Mock-first coverage of SniTrayImpl's off-caller-thread sender (e5e6b5f),
no session bus required: DBusBindings is rebuilt with recording
MethodHandles and messages are enqueued as recognizable zero-length
segments straight into the outgoing queue.

Covers: close() with nothing queued (sender exits, connection unref'd
once); FIFO drain with per-message flush + unref; close() mid-flush
(in-flight send/flush/unref triplet completes, the rest of the queue is
drained by unref without sending); concurrent emit from many threads
(no loss, per-thread submission order preserved on the wire).

Seam: SniTrayImpl + DBusBindings constructors and SniTrayImpl.outgoing
go private -> internal so the test source set can drive them. No public
API change. The optional real-session-bus smoke is left as a follow-up.

Closes #2
@Kitty-Hivens Kitty-Hivens merged commit a5f8d7c into main May 29, 2026
1 check passed
@Kitty-Hivens Kitty-Hivens deleted the test/sni-sender-lifecycle branch May 29, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(linux): cover sni sender thread lifecycle + outgoing queue drain

1 participant