test(inttest): udp/unix/unixgram raw-dest e2e (generalize socket-sink) - #112
Merged
Conversation
Generalize the merged tcp-sink flavor into a scheme-parameterized
socket-sink and add udp-sink, unix-sink, unixgram-sink lifecycle flavors,
completing daemon-level e2e coverage for the raw socket destinations
(they were Go-component-only). Each streams jsonl over `-dest <scheme>:...`
to an in-VM receiver; the RAW_SOCKET self-test check validates the received
records carry a non-empty hostname AND the per-scheme send counter ran.
Framing-agnostic check: `grep '{...}'` extracts JSON objects, which strips
the unix STREAM dest's varint length prefix and is a no-op for the
newline-delimited jsonl of tcp/udp/unixgram. Per-scheme send metric
(destTCP/Writes, Inetdiager/udpWrites, destUnix/Writes, destUnixGram/Writes).
Receivers: ncat listens dual-stack on [::] for tcp/udp and on the socket
path for unix STREAM. unixgram uses socat's UNIX-RECV — ncat can't LISTEN
on a unix DATAGRAM socket (`--unixsock --udp --listen` fails with
"connect: Invalid argument").
Dual-stack for inet dests: xtcp2 dials `tcp/udp:localhost:...` (127.0.0.1
AND ::1); the sink binds [::] (bindv6only=0 → also IPv4-mapped).
Wiring: mkVm.nix (socketSinkScheme/Dest/ReceiverCmd/Metric* bindings,
generalized ncat/socat sink service), self-test.nix (Check 5f generalized),
default.nix (mkOneSocketSink + mkLifecycleSocketSink helpers → 4 flavors),
nix/default.nix (boot + lifecycle apps/packages). Run:
nix run .#microvm-x86_64-lifecycle-{udp,unix,unixgram}-sink.
Verified (lifecycle microVM, all OVERALL_PASS):
udp records=65 Inetdiager/udpWrites=11
unix records=131 destUnix/Writes=14 (varint framing, malformed=0)
unixgram records=86 destUnixGram/Writes=12
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What & why
Complete daemon-level e2e coverage for the raw socket destinations.
tcpgot an e2e flavor in #111;udp/unix/unixgramwere Go-component-only. This generalizes tcp-sink into a scheme-parameterized socket-sink and adds udp-sink, unix-sink, unixgram-sink lifecycle flavors.Each streams jsonl over
-dest <scheme>:…to an in-VM receiver; theRAW_SOCKETself-test check validates the received records carry a non-emptyhostnameand the per-scheme send counter ran.Notable bits
grep '{...}'extracts JSON objects — strips the unix STREAM dest's varint length prefix, and is a no-op for the newline-delimited jsonl of tcp/udp/unixgram. Per-scheme send metric (destTCP/Writes,Inetdiager/udpWrites,destUnix/Writes,destUnixGram/Writes).[::](tcp/udp) or the socket path (unix STREAM). unixgram uses socat'sUNIX-RECV— ncat can't LISTEN on a unix DATAGRAM socket (--unixsock --udp --listen→connect: Invalid argument).localhost(127.0.0.1 and ::1); the sink binds[::].mkOneSocketSink/mkLifecycleSocketSinkhelpers; the four flavors share one arg/service/check.Verification (lifecycle microVM, all
OVERALL_PASS)Inetdiager/udpWrites=11destUnix/Writes=14destUnixGram/Writes=12(tcp-sink #111 already covers tcp.) Run:
nix run .#microvm-x86_64-lifecycle-{udp,unix,unixgram}-sink.Follow-up completing the destination-coverage plan. Also confirmed stderr already has a test (
TestStderrDestFactory), so the earlier "stderr untested" note was stale.🤖 Generated with Claude Code