Skip to content

test(inttest): udp/unix/unixgram raw-dest e2e (generalize socket-sink) - #112

Merged
randomizedcoder merged 1 commit into
mainfrom
feat/inttest-socket-dests
Aug 3, 2026
Merged

test(inttest): udp/unix/unixgram raw-dest e2e (generalize socket-sink)#112
randomizedcoder merged 1 commit into
mainfrom
feat/inttest-socket-dests

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

What & why

Complete daemon-level e2e coverage for the raw socket destinations. tcp got an e2e flavor in #111; udp/unix/unixgram were 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; the RAW_SOCKET self-test check validates the received records carry a non-empty hostname and the per-scheme send counter ran.

Notable bits

  • Framing-agnostic check: 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).
  • Receivers: ncat listens dual-stack on [::] (tcp/udp) or the socket path (unix STREAM). unixgram uses socat's UNIX-RECV — ncat can't LISTEN on a unix DATAGRAM socket (--unixsock --udp --listenconnect: Invalid argument).
  • Dual-stack for inet dests: xtcp2 dials localhost (127.0.0.1 and ::1); the sink binds [::].
  • DRY: mkOneSocketSink / mkLifecycleSocketSink helpers; the four flavors share one arg/service/check.

Verification (lifecycle microVM, all OVERALL_PASS)

scheme records send counter
udp 65 Inetdiager/udpWrites=11
unix 131 (varint, malformed=0) destUnix/Writes=14
unixgram 86 destUnixGram/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

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>
@randomizedcoder
randomizedcoder merged commit f7cb2d5 into main Aug 3, 2026
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.

1 participant