test: add baseline table-driven tests for listener build, merge and compare

Covers current correct behaviour of the pure functions in internal/gateway.
Known-buggy inputs (wildcards, collisions, truncation) are left out on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 20:36:11 +02:00
co-authored by Claude Opus 5.5
parent 3766e94b35
commit ab408403bc
2 changed files with 297 additions and 1 deletions
@@ -7,7 +7,7 @@ Plan: `docs/plans/2026-10-08-2028-house-conventions.md`
- [x] Step 2 — `.claude/` and docs scaffolding
- [x] Step 3 — Makefile, lint, formatting
- [x] Step 4 — Module path and version identity
- [ ] Step 5 — Baseline tests
- [x] Step 5 — Baseline tests
- [ ] Step 6 — CI build workflow
- [ ] Step 7 — Close out
@@ -113,3 +113,20 @@ flag wiring is verified by `--help` output and the build only. `GOARCH` defaults
`amd64` when `TARGETARCH` is empty (legacy builder, as on the CI runner) and follows
the host under BuildKit, so a local build on an Apple Silicon machine is arm64.
`docs/flows.md` still cites pre-change `main.go` line numbers in §2.
## Step 5 — Baseline tests
`internal/gateway/patch_test.go`: five table-driven tests over the pure functions.
```
$ go test -race -cover ./...
ok .../internal/gateway 1.870s coverage: 96.9% of statements
ok .../internal/version 2.196s coverage: 94.7% of statements
```
Worth noting: `internal/controller` and `main` are at 0%; reconciler tests with the
fake client come with the first reconcile fix. Wildcard names, name collisions and
truncation are deliberately not asserted, so the suite does not pin behaviour that
the bug-fix phase will change. `TestListenersEqual_managedFields` only asserts the
four fields the comparison covers today; it says nothing about protocol, allowed
routes or TLS mode.