Commit c669817
test: mandatory hermetic CLI integration suite + CI gate
The CLI had thin coverage (validateResourceName + 3 provision tests). A CLI
change could silently break provisioning, `up` reconcile, auth, or flag
parsing with nothing catching it. This makes CLI integration testing a
hard, automated gate.
What's added:
- cmd/testapi_test.go: a stateful in-process mock of the agent API,
emulating the documented openapi.json contract (provision endpoints,
resource list, credentials, delete, auth/cli). Stateful so the suite can
PROVE resources are torn down.
- cmd/integration_test.go: 22 end-to-end tests driving the real cobra
command tree exactly as a shell would — db/cache/nosql/queue new, up
(+ --dry-run/--emit-env/--env/--file/idempotent reconcile/webhook),
resources, status, whoami/login/logout, unknown-command, --help. Asserts
exit codes, stdout/stderr shape, error handling, the resolved-env default
(empty env -> "development", CLAUDE.md rule 11), and auth handling.
- Resource-cleanup is MANDATORY: every provisioning test defers a per-token
DELETE, and a suite-level sweep in t.Cleanup FAILS the run if any resource
is left on the mock. Verified the sweep fires on a deliberate leak.
- cmd/livesmoke_test.go: optional `livesmoke`-tagged live-prod smoke test,
off by default, provision-then-teardown with mandatory defer cleanup.
- Makefile: `make test` / `make ci` — the local gate is identical to CI.
- .github/workflows/ci.yml: now watches `master` (was `main` only — the
repo's default branch is master, so CI never actually ran). Runs the
hermetic suite under -race on every push/PR; a failure blocks.
The whole hermetic suite runs with zero network access.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 115fd53 commit c669817
5 files changed
Lines changed: 1293 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
3 | 12 | | |
4 | 13 | | |
5 | | - | |
| 14 | + | |
6 | 15 | | |
7 | | - | |
| 16 | + | |
8 | 17 | | |
9 | 18 | | |
10 | 19 | | |
| 20 | + | |
11 | 21 | | |
12 | 22 | | |
13 | 23 | | |
| |||
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
0 commit comments