Repository navigation
fix(#59): check failedTemplate messages exactly and guard against unchecked assertions - #61
Merged
Conversation
…hecked assertions helm-unittest 0.5.2 drops errorPattern, so 17 failedTemplate assertions passed on any render failure. Switch them to exact errorMessage, fix the config-chown test that was failing on the volumeMounts guard instead of its own, and add ci/check-failed-template.sh (run by make test-unit): a static check that every failedTemplate carries errorMessage, plus a negative-control suite whose assertions must all fail. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4 of 5 tasks
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.
Closes #59
helm-unittest 0.5.2 (pinned in the Makefile) only knows
errorMessageonfailedTemplate. It dropserrorPatternwhen it decodes the YAML, and afailedTemplatewith no message passes on any render failure (validator source at v0.5.2:FailedTemplateValidatorhas a singleErrorMessagefield). This PR switches all 17errorPatternassertions to the exacterrorMessage. Doing that turned up one test that was passing for the wrong reason:config-chown fails when mountPath does not contain the config dirfailed on the volumeMounts guard ("arcadedb.configDirectory (/var/lib/arcadedb/config) is not on any volumeMounts entry"), not on the config-chown guard it is named for. It now mounts the custom config directory, so the config-chown guard is the one that fires. To stop this from coming back,make test-unitnow runsci/check-failed-template.sh:failedTemplateintests/*_test.yamlmust carryerrorMessage. AnyerrorPatternis rejected, and so is{}, an empty block, or a misspelled key.tests/negative-control/failed_template_control.yamlhas three assertions that must all fail: a wrong message, a prefix of the real message, and a render that succeeds. If any of them passes, the installed plugin has stopped checking messages, and the check fails. The file name does not end in_test.yaml, so the normal suite glob skips it.tests/is in.helmignore, so the file is not packaged.The README testing section now documents the rule.
I chose this over upgrading helm-unittest to 1.x, which matches
errorPattern. The upgrade is a major-version jump, anderrorMessagegives a stricter check on any plugin version. The script header says how to relax check 1 after an upgrade.Test plan
make test-unit: 364/364 pass, static check OK, negative control 3/3 failed as expectedmake linterrorPattern:is renamed toerrorMessage:, the "Actual" output shows each real message. Each newerrorMessageis that message verbatim.main's tests: reports everyerrorPatternlinefailedTemplate: {}, typo keyerrorMesage, a commented block witherrorPattern, an empty block at EOF): all 4 reported, exit 12 failed, 1 passedand exits 1unittestjob (Helm v4.1.4) greenCoverage
Invariant: every
failedTemplateassertion proves that the render fails with the stated message.errorMessageassertions (13, in certificate/config_seed/gremlin_port/helpers/native/quorum_guard/service)ci/check-failed-template.shinmake test-unit(CIunittestjob)Known gaps: None for
failedTemplate. helm-unittest 0.5.2 also silently ignores unknown keys on other assertion types. That is outside this issue's scope and was not observed in the current suites.Adversarial pass
I could not run it: this session has no subagent tool, so the independent Phase 1.5 reviewer was not spawned. A self-check turned up the masked config-chown test described above, which is fixed here.
Review cycles
3bf2565, initial fix. No bot review came in within the 15-minute window. This repo has no Claude Code Review workflow (.github/workflowshas only lint, integration, latest-image and release), and PR feat(#45): pass the HA fallback root password as an env var, not -D #55 has noclaudecomments either. CI is green (6/6).Deferred items
None.
Final state: timeout (no automated reviewer is configured on this repo). A human review is needed.
🤖 Generated with Claude Code