Imported from procoduck/shepherd (
e2e/AGENTS.md). Install upstream withnpx skills add procoduck/shepherd --skill e2e. Copyright stays with the author.
Shepherd E2E
Compose-based e2e suites (//go:build e2e) plus the kind-based Kubernetes suite in k8s/
(//go:build e2ek8s). Always run through make — the targets exist to stop you testing stale images.
Commands
make e2e— core flow (registration, pipelines, GitOps, RBAC); excludessandbox-simmake e2e-sim— S3 sandbox suite: containment probes first, then run-lifecycle specsmake e2e-egress— the containment probes alone (fast local check)make e2e-k8s— kind cluster suite: Helm install, NetworkPolicy enforcement (CNI negative control first), Gateway API route conformance and operator-owned attachment verification; ~500s for six features incl. cluster create/destroy- Focused run against a running stack (
E2E_KEEP=1first):ginkgo --tags=e2e --focus "GitOps" ./e2e
Rules
- Never run raw
ginkgo ./e2eorgo test -tags e2ek8sas the primary invocation. The make targets depend ondocker-build-local/docker-build-init/docker-build-simulator, so the stack runs images built from THIS working tree. A raw run tests whatever stale image the daemon holds — a source fix appears not to work, or a regression passes. (The k8s suite warns on image-mtime skew, but that is a hint, not a guard.) - Labels are load-bearing. Every S3 spec carries
sandbox-sim(this is whatmake e2e's!sandbox-simfilter excludes, since its stack boots without the simulator); the reachability probes — THE control bounding what a sandbox run can reach — additionally carrysandbox-egress, so an egress probe always has BOTH labels.make e2e-simruns the egress pass with--fail-on-emptyso a typoed or deleted label fails the build instead of ginkgo reporting "Ran 0 of N Specs" and exiting 0. Keep new S3 specs inside this taxonomy. - Ordered flow, independent scenarios. The main suite is one
OrderedDescribe; scenarios must not depend on each other beyond that documented ordering (a failed earlier step skips dependents). Standalone Describes (e.g. auth) must not reuse state (orgID etc.) from the ordered flow. - No
time.Sleepin specs — useEventually. (Bounded backoff inside helper retry loops, e.g.gitea_helpers_test.go, is the one exemption.)
Debugging
E2E_KEEP=1 make e2e(or e2e-sim) leaves the compose stack running; tear down withdocker compose -f e2e/docker-compose.e2e.yaml down -v.E2E_K8S_KEEP=1keeps the kind cluster AND namespaces;make e2e-k8s-cleanremoves clusters a SIGKILLed run left behind (the one path no in-process teardown covers). Seee2e/k8s/README.md.- E2E stack login:
admin/e2e-local-admin-pass(the dev stack usesadmin/admin).
Fixtures
mockmsft/— mock Entra/Graph server; tests inject state viaPOST /__fixture(seee2e_test.go).- Gitea is the git server for GitOps scenarios;
gitea_helpers_test.goowns repo/token/push helpers.