Skip to content

Add helm-unittest suite for operator-crds toggles#5468

Open
ChrisJBurns wants to merge 2 commits into
mainfrom
implement-helm-unittests-for-toolhive-following-ll
Open

Add helm-unittest suite for operator-crds toggles#5468
ChrisJBurns wants to merge 2 commits into
mainfrom
implement-helm-unittests-for-toolhive-following-ll

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Collaborator

Summary

The operator-crds chart wraps every CRD in two values gates — crds.install (gates the whole render) and crds.keep (gates the helm.sh/resource-policy: keep annotation). A regression in either is silent: helm install still succeeds when the install gate is removed, and a dropped keep annotation silently cascade-deletes CustomResources on uninstall. ct install cannot catch these failure modes. This adds a helm-unittest suite to make both behaviours red-on-break, following the pattern established in stacklok-llm-gateway.

Medium level
  • Add deploy/charts/operator-crds/tests/toggles_test.yaml — three tests (default render, crds.install=false, crds.keep=false) asserted per template across all 13 CRDs.
  • Add a helm-unittest task to the Taskfile that installs the plugin (pinned v1.0.3) if missing and runs the suite.
  • Add a Run helm-unittest step to the helm-charts-test workflow between ct lint and the KIND install, invoking task helm-unittest.
  • Exclude tests/ from the packaged chart via .helmignore.
Low level
File Change
deploy/charts/operator-crds/tests/toggles_test.yaml New helm-unittest suite covering all 13 CRDs
Taskfile.yml New helm-unittest task; pins plugin version v1.0.3
.github/workflows/helm-charts-test.yml New CI step running task helm-unittest after lint
deploy/charts/operator-crds/.helmignore Exclude tests/ from packaged chart

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation
  • Other (test + CI tooling)

Test plan

  • task helm-unittest passes (3 tests × 13 CRDs)
  • Verified red-on-break: forcing the keep annotation unconditional in one CRD fails the crds.keep=false test; restoring the template returns it to green
  • Plugin version pin matches between Taskfile and CI workflow

Special notes for reviewers

  • Scoped to operator-crds only, matching the example repo. The operator chart's templates don't have these toggles; adding a suite there would be separate follow-up work.
  • The helm-unittest plugin version is pinned in the Taskfile and cross-referenced from the CI workflow comment — bump them together.

Generated with Claude Code

The operator-crds chart wraps every CRD in two values gates:
crds.install (gates the whole render) and crds.keep (gates the
helm.sh/resource-policy: keep annotation). A regression in either is
silent — `helm install` still succeeds with the install gate removed,
and a dropped keep annotation silently cascade-deletes CRs on uninstall.
`ct install` cannot catch these.

Add a helm-unittest suite covering all 13 CRDs that asserts the default
render, crds.install=false, and crds.keep=false behaviours, plus a
`task helm-unittest` runner and a CI step. Following the pattern
established in stacklok-llm-gateway.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Jun 8, 2026
The suite will grow beyond the operator-crds toggles, so replace the
toggle-specific comment with a generic note on what helm-unittest is
and why we run it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Jun 8, 2026
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.21%. Comparing base (87fa2ac) to head (52c2966).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5468      +/-   ##
==========================================
- Coverage   69.23%   69.21%   -0.03%     
==========================================
  Files         636      636              
  Lines       64724    64724              
==========================================
- Hits        44810    44797      -13     
- Misses      16605    16617      +12     
- Partials     3309     3310       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants