cintegration: mock daemon pushes datagrams + accepts inbound dials#4
Merged
Conversation
Extends the harness to cover the two endpoints still stuck at the FFI- bound ceiling: PilotRecvFrom (0.0% -> 71.4%): the mock now reflects every cmdSendTo back to the same client as a cmdRecvFrom frame, with srcPort=0xDEAD as a sentinel. The harness sends a datagram, calls PilotRecvFrom, and asserts the JSON envelope contains the reflected dst_port and the sentinel src_port. PilotListenerAccept (30.0% -> 80.0%): the mock keeps a process-wide listenerRegistry keyed by bound port; when one connected client dials a port another client has bound, the mock pushes a cmdAccept frame on the listener's socket. clientConn carries a write mutex so frames from the dial handler can't interleave with the listener's own replies. Bound ports are cleaned up when the listener's connection drops. The new test_mock_listener_accept opens two PilotConnect handles and drives Listen on A, Dial on B, Accept on A end-to-end. Total coverage: 66.3% -> 68.5%.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
cmdSendToback to the same client as acmdRecvFromframe (sentinelsrcPort=0xDEAD), soPilotRecvFromfinally exercises its happy path.listenerRegistrykeyed by bound port; when client B dials a port client A has bound, the mock pushescmdAccepton A's socket, with a write-mutex onclientConnto keep cross-goroutine frames non-interleaved.boundPortsis cleaned up on disconnect.harness.c:test_mock_recv_fromandtest_mock_listener_accept(the latter opens twoPilotConnecthandles and drives Listen on A, Dial on B, Accept on A).Coverage delta
Total
66.3% -> 68.5%(+2.2pp), both target endpoints off 0%:PilotRecvFromPilotListenerAcceptPilotListenerAcceptwas already at 30% becausetest_accept_bad_handlehit its error branch; the new test drives the success branch.Test plan
cd cintegration && make clean && make cover— 72/72 PASS, 0 FAILgo tool cover -func=coverage.out | grep -E "RecvFrom|ListenerAccept"confirms the new percentagesbindings.go,embedded.go); onlycintegration/harness.candcintegration/mockdaemon/main.gochanged