Skip to content

test(rabbitmq): add default render helm unit tests - #4081

Open
Akanksha Trehun (magic-peach) wants to merge 1 commit into
cozystack:mainfrom
magic-peach:test/rabbitmq-helm-unittest
Open

Akanksha Trehun (magic-peach) wants to merge 1 commit into
cozystack:mainfrom
magic-peach:test/rabbitmq-helm-unittest

Conversation

@magic-peach

@magic-peach Akanksha Trehun (magic-peach) commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

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 standard test: 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 actual make test target as well.

Screenshots

Not applicable, test-only change.

Downstream repositories

  • No downstream repository is affected by this change

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.yaml or README.md, so none of the listed triggers apply.

Release note

test(rabbitmq): add Helm unit test coverage for the default render

Summary by CodeRabbit

  • Tests

    • Added Helm chart tests covering RabbitMQ cluster replicas, container image, and persistent storage settings.
    • Added coverage for user configuration, including generated user and credentials resources.
  • Chores

    • Added a Make target for running the RabbitMQ Helm chart test suite.

rabbitmq was one of the remaining user-facing apps with no
helm-unittest coverage.

Assisted-by: LLM
Signed-off-by: Akanksha Trehun <[email protected]>
@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review size/M This PR changes 30-99 lines, ignoring generated files labels Sep 4, 2026
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: a3a2ffe9-cd36-4f15-bfff-67b0fc5fbb02

📥 Commits

Reviewing files that changed from the base of the PR and between 3a369fe and 40dd971.

📒 Files selected for processing (2)
  • packages/apps/rabbitmq/Makefile
  • packages/apps/rabbitmq/tests/rabbitmq_test.yaml

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The RabbitMQ app now includes Helm unit tests for default rendering and configured user credentials. A phony Makefile target runs the chart tests with helm unittest ..

Changes

RabbitMQ Helm tests

Layer / File(s) Summary
Chart render assertions
packages/apps/rabbitmq/tests/rabbitmq_test.yaml
The tests validate the default RabbitmqCluster configuration and the User and credentials Secret generated for alice.
Test command wiring
packages/apps/rabbitmq/Makefile
The Makefile adds a phony test target that runs helm unittest ..

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 40dd9

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)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the RabbitMQ Helm unit tests and matches the primary changes in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@IvanHunters IvanHunters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@IvanHunters

Copy link
Copy Markdown
Collaborator

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?

IvanHunters added a commit that referenced this pull request Sep 22, 2026
## 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 -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants