Skip to content

test: maximize cmd/go-rcp and tsn coverage - #70

Merged
SoundMatt merged 1 commit into
mainfrom
test/cli-and-tsn-coverage
Jun 19, 2026
Merged

test: maximize cmd/go-rcp and tsn coverage#70
SoundMatt merged 1 commit into
mainfrom
test/cli-and-tsn-coverage

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Makes the CLI commands testable and covers the previously-untested command and registry surface. No behaviour changerelay conform --strict still passes, and the capabilities/version/status documents are byte-for-byte unchanged.

Package Before After
cmd/go-rcp 26.6% 71.7%
tsn 28.8% 97.5%

cmd/go-rcp

  • cmdVersion/cmdCapabilities/cmdStatus/cmdDiscover now take an io.Writer; cmdSend returns an exit code (was os.Exit/log.Fatalf); cmdMonitor takes a context + writer. main() wiring unchanged in behaviour.
  • Unit tests for the §11.1 mandatory commands (JSON + text), flagFormat, and the RCP commands (discover, send success + unknown-zone, monitor). The remaining gap is main()'s arg dispatch.

tsn

  • The 28.8% was untested registry/accessor surface, not truly platform-gated. Added tests for Subscribe, Send-after-close, NewController bad-addr, and the full Registry (Dial, Register dup/foreign, Deregister, Lookup, Controllers, Close, closed-registry errors).

  • Only the Linux SO_PRIORITY syscall (sockprio_linux.go) remains uncovered on darwin — exercised on the Linux CI runner.

  • .gitignore: ignore the /go-rcp and /rcptool CLI build artifacts.

Verification

gofusa check, golangci-lint v2, go vet ./..., go test -race ./..., relay conform --strict — all PASS.

Make the CLI commands testable (inject io.Writer / return exit codes
instead of writing to os.Stdout and calling os.Exit/log.Fatalf) and cover
the previously-untested command and registry surface. No behaviour change —
'relay conform --strict' still passes.

- cmd/go-rcp 26.6% -> 71.7%: unit tests for the §11.1 mandatory commands
  (version/capabilities/status, JSON + text), flagFormat, and the RCP
  commands (discover, send success/unknown-zone, monitor). cmdVersion/
  cmdCapabilities/cmdStatus/cmdDiscover now take an io.Writer; cmdSend
  returns an exit code; cmdMonitor takes a context + writer.
- tsn 28.8% -> 97.5%: the gap was untested registry/accessor surface, not
  truly platform-gated. Added tests for Subscribe, Send-after-close,
  NewController bad-addr, and the full Registry (Dial, Register dup/foreign,
  Deregister, Lookup, Controllers, Close, closed-registry errors). Only the
  Linux SO_PRIORITY syscall (sockprio_linux.go) remains uncovered on darwin;
  it is exercised on the Linux CI runner.
- .gitignore: ignore the /go-rcp and /rcptool CLI build artifacts.

All gates green: gofusa check, golangci-lint v2, go vet, go test -race ./...,
relay conform --strict.

Signed-off-by: SoundMatt <47545907+SoundMatt@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 7fd1ba6 into main Jun 19, 2026
12 checks passed
@SoundMatt
SoundMatt deleted the test/cli-and-tsn-coverage branch June 19, 2026 16:21
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