Repository navigation
test: add tests of the Helm chart - #236
Merged
Merged
Conversation
Render the chart with helm template for the default values and the main options (resources, images, security context, auth, service info, ingress, OpenShift route, NodePort, S3 and OpenStack storage, FTP, transfer) and check the rendered objects. Run them in the chart job, where a missing helm fails them (REQUIRE_HELM). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the helpers to tests/helm.py as in cloud-registry, cover the port, base path, context path, ingress annotations, auth groups and route host, read default images from values.yaml, accept only 1, true or yes for REQUIRE_HELM, and leave the chart tests out of the test job so they run only with the pinned Helm. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Reviewer's GuideThe PR adds a reusable Helm-rendering test harness and 25 manifest-level tests for the chart’s defaults and major configuration paths, then runs them in the Chart CI job with pinned Helm while preserving the existing docs-hook coverage workflow and documenting the setup. Sequence diagram for Helm chart manifest tests in CIsequenceDiagram
participant Chart as Chart CI job
participant Action as test-chart action
participant Pytest as pytest
participant Helm as Helm 3.22.1
participant Tests as tests/test_chart.py
participant ChartFiles as charts/tesk
Chart->>Action: run
Action->>Helm: helm lint charts/tesk --strict
Action->>Helm: helm template charts/tesk
Action->>Pytest: REQUIRE_HELM=1 pytest
Pytest->>Tests: collect 25 chart tests
Tests->>Helm: render
Helm->>ChartFiles: load chart and values
Helm-->>Tests: rendered Kubernetes objects
Tests->>Tests: find and get objects
Tests-->>Pytest: assert manifests and configuration
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #236 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 199 199
=========================================
Hits 199 199 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
November 6, 2026 06:03
Contributor
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/helm.py" line_range="55" />
<code_context>
+ for manifest in manifests:
+ # Some templates render names with trailing whitespace (e.g., the
+ # ingress), which YAML keeps in a plain scalar's value
+ if manifest["kind"] == kind and manifest["metadata"]["name"].strip() == name:
+ return manifest
+ return None
</code_context>
<issue_to_address>
**Invalid ingress name passes lookup**
When the rendered Ingress name has trailing whitespace, `find` strips `metadata.name` before comparing it, so `test_defaults` accepts an Ingress named `ingress-rules `; Kubernetes rejects that name, but the test still passes.
Compare the unmodified name and fix the ingress template so the rendered name is valid.
</issue_to_address>
### Comment 2
<location path="tests/test_chart.py" line_range="271-272" />
<code_context>
+ """S3 storage renders the secret with the AWS configuration."""
+ manifests = render("--set", "storage=s3")
+ assert set(get(manifests, "Secret", "aws-secret")["data"]) == {
+ "config",
+ "credentials",
+ }
+ assert find(render(), "Secret", "aws-secret") is None
</code_context>
<issue_to_address>
**AWS secret values go unchecked**
When the rendered secret has the expected keys but its values are empty, incorrect, or come from missing files, `test_storage_s3` checks only the keys in `Secret.data`, so it passes without verifying the AWS configuration values and a broken configuration goes unnoticed.
Assert that the rendered secret’s `config` and `credentials` values contain the expected AWS configuration.
</issue_to_address>Linked issues
#227 test: add chart tests · 3 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Test the default chart and main options by rendering with Helm and checking the rendered objects. | ✅ Met | The chart tests cover defaults and the requested ingress, OpenShift route, storage, auth, and service-info options. |
| 2 | Run the chart tests in the CI chart job. | ✅ Met | The chart job invokes the test-chart action, which runs pytest with Helm required. |
| 3 | Do not report chart-test coverage to Codecov. | ✅ Met | The general test job excludes the chart tests from coverage; the chart job runs them separately. |
Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: tests/helm.py:55, tests/test_chart.py:272
Render a copy of the chart with S3 files and check the decoded secret, and compare object names as rendered, without stripping them (Sourcery review). Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # .github/actions/test-chart/action.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds tests of the Helm chart, modelled on cloud-registry's chart tests:
tests/helm.pyholds the helpers.renderrunshelm templateofcharts/tesk.findandgetlook up rendered objects.containerandenvreturn the API container and its environment.VALUESholds the default values.tests/test_chart.pyhas 25 tests that render the chart and check the objects:auth.service_info_publicset to true, false or null, and the service-info ConfigMap and its mount..github/actions/test-chartruns the tests after lint and render, in theChartjob, with the pinned Helm v3.22.1.REQUIRE_HELM=1makes a missing Helm fail the job instead of skipping the tests. TheTestjob leaves them out (--ignore=tests/test_chart.py), so they run only with the pinned Helm. Coverage is unaffected: it measuresdocs/.docs/development.mddescribes the chart tests and the CI split.Closes #227
Verification
REQUIRE_HELM=1 pytest: 65 passed (25 chart, 40 hooks).coverage run -m pytest --ignore=tests/test_chart.py: 40 passed, 100% coverage.REQUIRE_HELM=1and no Helm, collection fails.mypyandruff(check and format): pass.actionlint: pass.mkdocs build --strict: pass.Review
Full review: adversarial-reviewer and quality-reviewer, 2 rounds, no high findings.
tests/helm.py.values.yaml.Test.REQUIRE_HELM.Declined review findings
None.
Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Add automated Helm chart tests and integrate them into CI to validate rendered resources across the chart’s main configuration options.
Enhancements:
CI:
Documentation:
Tests: