This directory holds reusable, cross-package test infrastructure. Per-package
unit and integration tests live next to the code they cover.
Testing tiers
Tier 1 — Unit. Pure Go, no cluster. Run on every PR via make test.
Tier 2 — Integration.
envtest (real API server + etcd, no kubelet) for reconcile logic, CRD
validation, and Server-Side Apply ownership/merge. Bootstrapped by
internal/testenv; skipped automatically when
KUBEBUILDER_ASSETS is unset. Use make test-integration (or the CI
Build & Test job, which provisions envtest) to run these.
git-server fixture — a real smart-HTTP git server backed by
git-http-backend (a bare clone of a seeded repo, served over TLS with
optional basic auth), in
internal/git/httpfixture_test.go.
It exercises the full network path through git.Client.Fetch: ref/tag
resolution, subpath extraction, auth success/failure, unreachable host, and
the SSRF/allow-list guards. Tests skip when git/git-http-backend is
unavailable.
Tier 3 — E2E (kind). A real cluster with kubelet and controllers. See
test/e2e.
test/leakcheck registers known fixture secret values and asserts they never
appear in status, events, logs, or applied objects. It runs on every PR as
part of go test ./... (imported by reconcile package tests). Add a leak scan
to any new test that flows secret material through status, events, or objects.