Repository navigation
test(rabbitmq): add default render helm unit tests - #4081
Akanksha Trehun (magic-peach) wants to merge 1 commit into
Conversation
rabbitmq was one of the remaining user-facing apps with no helm-unittest coverage. Assisted-by: LLM 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 RabbitMQ app now includes Helm unit tests for default rendering and configured user credentials. A phony Makefile target runs the chart tests with ChangesRabbitMQ Helm tests
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds RabbitMQ chart render coverage and a command to run it, without changing deployed chart behavior. No current merge-blocking risk remains. 🚥 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 |
IvanHunters
left a comment
There was a problem hiding this comment.
Verdict
LGTM with non-blocking notes
Thanks for this, it's a genuinely useful one to land. rabbitmq was among the app charts still shipping with no test target at all, and the suite is wired up correctly: hack/helm-unit-tests.sh discovers the target on its own, so there is no registration list to forget. I also checked the asserts aren't vacuous, and they aren't. Reverting the replicas default, the size default or the Secret name suffix each turns the suite red.
Two small notes left inline. Neither blocks the merge.
One correction to the description: http-cache doesn't actually have a test: target or a tests/ directory, so it isn't the sibling this follows. Plenty of others do (17 app charts), http-cache just isn't one of them.
If you want to take it further later, a users: {alice: {}} case asserting exists: stringData.password would cover the generated-password branch, the way mongodb/tests/user-secrets_test.yaml does.
| value: 3 | ||
| - equal: | ||
| path: spec.image | ||
| value: "rabbitmq:4.2.4-management" |
There was a problem hiding this comment.
hack/update-versions.sh regenerates files/versions.yaml from the newest upstream patch of each major.minor, and nothing freezes the default line. So when RabbitMQ 4.2.5 lands, this assert goes red inside an unrelated version-bump PR, under a test name that says nothing about versions.
Matching the major.minor keeps the versionMap wiring covered without the drift:
- matchRegex:
path: spec.image
pattern: "^rabbitmq:4\\.2\\.[0-9]+-management$"clickhouse does assert an exact tag, but only because its own update script freezes the default tag and refuses to move it.
| - equal: | ||
| path: metadata.name | ||
| value: rabbitmq-test-alice-credentials | ||
| documentIndex: 2 |
There was a problem hiding this comment.
While you're pinning the Secret, apps.cozystack.io/user-secret: "true" is worth pinning too. It's the label the tenant resource map matches on to expose per-user credentials, so dropping it from the template breaks tenant access while this suite stays green.
- equal:
path: metadata.labels["apps.cozystack.io/user-secret"]
value: "true"
documentIndex: 2|
Both notes are small and the approval stands either way. Would you prefer to fold them into this PR, or leave them for a follow-up? |
## 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 -->
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
Akanksha Trehun (@magic-peach) NOT LGTM. Two small things, both needed before it can merge.
The branch conflicts with main on packages/apps/rabbitmq/Makefile. Main got its own test: target and several rabbitmq suites since this was opened, so the Makefile hunk should just be dropped in a rebase. What your suite adds on top of them is still useful: nothing on main asserts the default replica count, the default storage size, or the username and password in a user's credentials Secret. I ran tests/rabbitmq_test.yaml on current main (f6a615f) and it passes as is.
The spec.image == "rabbitmq:4.2.4-management" assertion should go. That string comes from files/versions.yaml, which hack/update-versions.sh rewrites on every RabbitMQ bump, so the test fails on each legitimate update and proves nothing about what the chart does. Please remove it rather than turn it into a regex, since the shape of the ref is not chart behaviour either.
What this PR does
Adds Helm unit test coverage for the rabbitmq application chart, per #3631, one of the remaining user-facing apps that shipped with no test target. Adds a
tests/suite and the standardtest: helm unittest .target to the Makefile, matching the pattern already used by http-cache and tested sibling charts.The suite covers the default render (RabbitmqCluster kind, replicas, pinned version image, storage size) and the per-user resource rendering (User and credentials Secret with an explicit password), the two behaviors a tenant actually relies on.
Ran
helm unittest .locally against the chart; both tests pass, verified with the actualmake testtarget as well.Screenshots
Not applicable, test-only change.
Downstream repositories
Walked the trigger map in docs/agents/contributing.md against the diff: this only adds test files 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
Tests
Chores