test: add end-to-end suite against a real tenant#47
Draft
piotrek-janus wants to merge 1 commit into
Draft
Conversation
Adds a build-tagged (//go:build e2e) suite under e2e/ that runs the compiled cac binary as a subprocess against the postmance-dev test tenant: - TestImportAndPull: create a workspace via `push --method import`, pull it back - TestImportRoundTrip: change the workspace name, re-import, pull into a fresh dir, and assert the change persisted (the contract assertion a mock can't make) Tenant constraints handled: workspaces are created via import (the client lacks server-admin rights), mutations use import (the rfc7396 patch endpoint is forbidden for this client), and runCAC retries the config API's burst rate-limit (request_forbidden) with backoff. Tests run sequentially. Credentials come from CAC_E2E_* env vars (gitignored .env.local locally, secrets in CI); .env.local.example documents them. CI runs on merge_group via .github/workflows/e2e.yaml. Env parsing uses subosito/gotenv (already in the module graph via viper). Workspace deletion is not yet implemented; runs leak e2e-* workspaces.
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
Adds a real-server end-to-end suite (
e2e/, build-tagged//go:build e2e) that drives the compiledcacbinary as a subprocess against thepostmance-devtest tenant. It targets the tool↔API contract — the class of bug a hand-written mock can't catch.Two tests:
TestImportAndPull— create a workspace viapush --method import, pull it back, assert the server file is written with the expected name.TestImportRoundTrip(core contract test) — change the workspace name locally, re-import, pull into a fresh dir, assert the change persisted remotely.How it runs
make test-e2elocally, orgo test -tags e2e ./e2e/.... The defaultgo test ./internal/...is unaffected (build tag).CAC_E2E_*env vars — a gitignored.env.locallocally (see.env.local.example), repo secrets in CI..github/workflows/e2e.yamlruns onmerge_groupso it executes once on the to-be-merged HEAD; intended as a required check via merge queue.Tenant constraints handled (discovered via live testing)
import— the e2e client lacks server-admin rights for the admin API.import, notpatch— the rfc7396 patch endpoint isrequest_forbiddenfor this client.request_forbidden;runCACretries with backoff and tests run sequentially.Known limitations / follow-ups
e2e-*workspaces (cleanup to be designed separately).masterand mark thee2ejob a required check; add theCAC_E2E_*secrets to thee2eenvironment.Design notes:
docs/superpowers/specs/2026-06-25-cac-e2e-tests-design.md.