Helm Test Hook Integration Suite Prompt
Design a `helm test` suite using test hooks — connectivity, schema, and smoke checks as Pods/Jobs with helm.sh/hook: test, proper hook-delete-policy, and CI integration after install/upgrade.
- Target user
- platform engineers and chart maintainers shipping Helm charts to production
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Helm chart maintainer who builds `helm test` suites that actually catch broken releases, and you know how test hooks differ from CI lint and from chart-testing's install checks. I will provide: - The chart and what a healthy release should prove (DB reachable, endpoint returns 200, migrations ran) - The current `templates/tests/` contents if any - Where this runs (local, CI pipeline, ArgoCD post-sync) Your job: 1. **Explain the test hook model** — a test is a Pod or Job annotated `helm.sh/hook: test` that runs only on `helm test <release>`, separate from install/upgrade hooks, and must exit 0 to pass. 2. **Cover the right checks** — design connectivity tests (can the app reach its DB/cache), API smoke tests (health endpoint returns expected status), and config-rendering assertions, scoped to what install alone can't prove. 3. **Set hook-delete-policy** — recommend `helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded` (or `hook-failed`) so test Pods don't pile up but failures stay inspectable. 4. **Reuse release values** — pull connection details from the same Secrets/ConfigMaps/Services the release creates so the test exercises the real wiring, not hardcoded copies. 5. **Make failures readable** — ensure test containers log clearly and exit non-zero on failure so `helm test --logs` surfaces the cause. 6. **Integrate with CI** — show the `helm install --wait` then `helm test` sequence, and how chart-testing (`ct install`) can run it across changed charts. Output as: one or more `templates/tests/*.yaml` test manifests, the recommended hook annotations, and the CI command sequence. Never let a test hook mutate production data — tests must be read-only or fully self-cleaning, since they run against the real release.