test(linux): SNI sender thread lifecycle + outgoing queue drain (#2)#8
Merged
Conversation
…#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #2: mock-first test coverage for the Linux SNI backend's
off-caller-thread sender (e5e6b5f), no session bus required.
DBusBindingsis rebuilt with recordingMethodHandles and messages areenqueued 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.
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.
per-thread submission order preserved on the wire.
Seam:
SniTrayImpl+DBusBindingsconstructors andSniTrayImpl.outgoinggo
private -> internalso the test source set can drive them. No publicAPI 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 testgreen -- 15 tests (4 new sender tests + existing 11), 0 failures