Skip to content

test: cover disableAutoDetectedKubeVersionForDiff precedence in diff flags - #2852

Merged
yxxhero merged 1 commit into
helmfile:mainfrom
yxxhero:issue-2848-disable-flag-tests
Oct 27, 2026
Merged

yxxhero merged 1 commit into
helmfile:mainfrom
yxxhero:issue-2848-disable-flag-tests

Conversation

@yxxhero

@yxxhero yxxhero commented Oct 24, 2026

Copy link
Copy Markdown
Member

Closes #2848

Problem

disableAutoDetectedKubeVersionForDiff had zero test coverage anywhere in the repo, even though it controls which --kube-version helm-diff receives.

Solution

Extend TestHelmState_DiffFlags with six table-driven cases covering both declaration sites and their interaction:

release-level helmDefaults configured kubeVersion diff receives
true — release 1.27 release 1.27 (not detected)
true — top-level 1.26 1.26
true — none no --kube-version
— true top-level 1.26 1.26
— true none no --kube-version
false true — detected 1.30.2 (release wins)

Also document in docs/configuration.md that a release-level kubeVersion takes precedence over the auto-detected cluster version for helm diff.

Verification

  • go test ./pkg/state/ -run 'TestHelmState_DiffFlags' -race -p=1 — 13/13 subtests pass
  • gofmt clean; targeted go build clean

…flags

TestHelmState_DiffFlags had no coverage for the
disableAutoDetectedKubeVersionForDiff flag (issue helmfile#2848). Add six
table-driven cases covering both declaration sites (release-level and
helmDefaults) and the precedence when both are set: with the flag on,
an explicit release- or top-level kubeVersion is passed to helm-diff
instead of the detected one; release-level false overrides
helmDefaults true; and no configured kubeVersion passes no
--kube-version flag at all. Also document the release-kubeVersion
precedence in docs/configuration.md.

Closes helmfile#2848

Signed-off-by: yxxhero <[email protected]>

Copilot AI left a comment

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.

🟢 Approval recommended

The focused test and documentation changes match the existing precedence behavior, with no unresolved findings.

No open issues 🎉

What changed in this PR

Adds regression coverage for Helmfile’s diff kube-version precedence, addressing #2848 without changing runtime behavior.

Changes:

  • Adds six table-driven cases covering release-level and helmDefaults disable settings, configured-version fallbacks, and release overrides.
  • Documents that a release-level kubeVersion takes precedence over the auto-detected version for diff.
File Description
pkg/​state/​state_test.go Extends diff-flag tests with disable-setting precedence cases and top-level kube-version inputs.
docs/​configuration.md Clarifies release-level kube-version precedence for diff.

Review effort: Balanced

@yxxhero
yxxhero merged commit bae6321 into helmfile:main Oct 27, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No test coverage for disableAutoDetectedKubeVersionForDiff

3 participants