cintegration: fake registry lifts PilotEmbeddedStart coverage#5
Merged
Conversation
PilotEmbeddedStart boots an in-process pkg/daemon that dials a real
registry over TCP — without one, the //export short-circuits at
daemon.Start() and the harness never reaches the rest of the function
(13.6% coverage baseline).
Adds cintegration/mockregistry/, a stdlib-only fake registry that
speaks length-prefixed JSON and answers register / lookup / heartbeat
with canned data. Daemon Start succeeds end-to-end (STUN fails but is
non-fatal — discoverWithTempSocket falls back to the local addr).
Harness now drives:
- embedded_start_with_mock_registry — full boot success path
- embedded_info_via_driver — proves the IPC socket is live
- embedded_health_via_driver — second IPC round-trip
- embedded_start_double_call — already-started guard
- embedded_stop_after_start — clean teardown
- embedded_start_{null_config,missing_data_dir,missing_socket_path} —
defaults() + early-return branches
- mock_dial_timeout(_bad_addr) — ParseSocketAddr success/error paths
- mock_member_tags_set_bad_json — json.Unmarshal error branch
- bad-handle smoke tests for the remaining 71–80% bindings
Coverage:
- libpilot total: 68.5% → 80.1%
- embedded.go PilotEmbeddedStart: 13.6% → 79.5%
- embedded.go PilotEmbeddedStop: 46.2% → 84.6%
- embedded.go defaults: 0% → 100%
- embedded.go unmarshalCString: 66.7% → 100%
89 pass, 0 fail.
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
cintegration/mockregistry/binary that speaks the registry's length-prefixed JSON protocol (register, lookup, heartbeat, etc.) with canned replies — enough to satisfypkg/daemon.Start()end-to-end.harness.cnow boots a real in-process embedded daemon pointed at the fake registry, then drives it throughPilotInfo/PilotHealth/PilotEmbeddedStopand exercises every early-return / guard branch inPilotEmbeddedStart.71–83%bindings round out the diff (PilotDisconnect, PilotConnSetReadDeadline, PilotDialTimeout, PilotMemberTagsSet).Coverage
embedded.go:PilotEmbeddedStartembedded.go:PilotEmbeddedStopembedded.go:defaultsembedded.go:unmarshalCString89 pass, 0 fail.
Test plan
cd cintegration && make clean && make build— all binaries linkcd cintegration && make run— 89/89 passcd cintegration && make cover— total ≥ 80.0%embedded_start_double_callexercises the singleton guard127.0.0.1:1is treated as a warning (no failure)bindings.go,embedded.go,coverflush.go)