Repository navigation
test(tcp-balancer): add default render helm unit tests - #4093
Akanksha Trehun (magic-peach) wants to merge 1 commit into
Conversation
tcp-balancer was one of the remaining user-facing apps with no helm-unittest coverage. Signed-off-by: Akanksha Trehun <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe TCP balancer chart gains a Makefile test target and a Helm unit test suite. The suite checks the default Deployment replica count and container image. ChangesTCP balancer chart validation
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change adds TCP balancer Helm test coverage for the default replica count and HAProxy image without changing chart runtime behavior. The test entry point and assertions are ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Akanksha Trehun (@magic-peach) NOT LGTM, because of the image assertion only. Another open PR fixes this chart, and the two collide in two places. #4366 adds the same test: target to the Makefile, which is a textual conflict. It also changes the image from haproxy:latest to haproxy:3.4.4, which turns your image assertion red.
That assertion pins the bug the other PR fixes. haproxy:latest resolves to 3.4.4 today. From 3.3 on HAProxy refuses a backend named like a frontend, so every tcp-balancer pod started now fails at config parse (#1966). The test is correct against main, but it makes that broken state part of the chart's contract.
What each side needs depends on the merge order:
- If #4366 lands first, this PR needs a rebase that drops the Makefile hunk, since the target will already exist, and a change to the image assertion.
- If this lands first, #4366 has to resolve the Makefile and rewrite or delete this assertion, which its image change turns red.
A prefix match keeps the check in both cases and leaves only the Makefile conflict:
- it: renders a Deployment with the default replica count and haproxy image
template: templates/deployment.yaml
documentSelector:
path: kind
value: Deployment
asserts:
- equal:
path: spec.replicas
value: 2
- matchRegex:
path: spec.template.spec.containers[0].image
pattern: '^haproxy:'I ran it against main and against #4366, on helm-unittest 1.1.1 and 1.1.2, and it passes each time. The line that scopes the test to the Deployment template matters too. Without it the test fails on helm-unittest 1.1.1 with document not found, because the documentSelector also runs against configmap.yaml and finds no Deployment there. 1.1.2 fixed that ("Fix documentSelector not working when multiple templates are used"), and CI installs the latest plugin, so it would pass there today.
The rest holds up. Changing the image, the default replica count or the kind each turns the test red, so the selector and the two equal checks are not vacuous. The new target is picked up too. The CI unit test job runs hack/helm-unit-tests.sh, which runs a package's tests when make -n test succeeds there, and it does here. CI has not run on this PR yet, since the fork workflows are still waiting for approval.
## What this PR does vpn was one of the eight user-facing apps in `packages/apps/` called out in #3631 as shipping with zero helm-unittest coverage. This adds a `tests/` suite pinning the default render and wires the standard `test: helm unittest .` target the sibling charts already use, following the same pattern as #4081, #4074 and #4093. Ran `helm unittest .` locally against the chart, it passes. `make show` needs a live cluster connection through `cozyhr`, which was not available in this environment, so I relied on `helm unittest` for local verification, same as the referenced sibling PRs. ### Screenshots Not applicable, test-only change. ### Downstream repositories Walked the trigger map in docs/agents/contributing.md against the diff: this only adds a test file and a Makefile target inside an existing package, it does not add, rename or remove a package, and it does not touch `values.yaml`, `values.schema.json`, `Chart.yaml` or `README.md`, so none of the listed triggers apply. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note test(vpn): add Helm unit test coverage for the default render ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Added automated validation for the VPN deployment’s default configuration, including replica count, container image, service port, and generated resource naming. - **Chores** - Added a convenient command for running the VPN chart’s automated tests. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
What this PR does
tcp-balancer was one of the eight user-facing apps in
packages/apps/called out in #3631 as shipping with zero helm-unittest coverage. This adds atests/suite pinning the default Deployment render (replica count, haproxy image) and wires the standardtest: helm unittest .target the sibling charts already use, following the same pattern as #4081 and #4074.Ran
helm unittest .locally against the chart, it passes, and also ran the repo's fullhack/helm-unit-tests.shsweep across every package to confirm nothing else broke.Screenshots
Not applicable, test-only change.
Downstream repositories
Walked the trigger map in docs/agents/contributing.md against the diff: this only adds a test file and a Makefile target inside an existing package, it does not add, rename or remove a package, and it does not touch
values.yaml,values.schema.json,Chart.yamlorREADME.md, so none of the listed triggers apply.Release note
Summary by CodeRabbit