Skip to content

chore: Convert the outdated Helm chart and semver tests to Ginkgo - #2038

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:ginkgo-helmchart-outdated-tests
Oct 15, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:ginkgo-helmchart-outdated-tests

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Follow-up to #2036. helmchart_outdated_check_test.go and helmchart_semver_test.go were the only tests in controllers still written with plain testing.T. They now use Ginkgo and Gomega like the rest of the package.

The tests move from package controllers to package controllers_test. What they need from unexported code is exposed through export_test.go, behind small exported types and functions that keep the unexported types (helmChartKey, outdatedHelmChartMetricKey, releaseInfo) out of the tests: CollectHelmChartRefs, HelmChartVersionDiff, SetResolvedHelmChartIdentity, and an OutdatedHelmChart type with helpers to set, run and inspect the outdated state of a chart.

The cases are the same as before: collecting chart references (conflict, unresolved identity as a table, grouping across ClusterSummaries), resolving the chart identity, the version diff table, and the four whole-pass cases of #2036 (deleted ClusterSummary, chart removed from the profile, chart that could not be checked, chart up to date).

One change in behavior of the tests: the "chart that could not be checked" case now uses an httptest server which is closed before the pass, instead of relying on nothing listening on port 1. The fetch still fails immediately, and it no longer depends on how the runner treats that port.

Testing: the 18 specs pass (-ginkgo.focus "Outdated Helm chart check|Helm chart version diff"), make lint reports 0 issues. Reverting the fix of #2036 makes the deleted-ClusterSummary spec fail.

🤖 Generated with Claude Code

The only tests of the controllers package still using plain testing.T now use
Ginkgo and Gomega like the rest of the package. They move to package
controllers_test, and what they need from unexported code is exposed through
export_test.go.

The test of a chart which could not be checked uses an httptest server which is
closed, instead of relying on nothing listening on port 1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gianlucam76
gianlucam76 merged commit c3bda18 into projectsveltos:main Oct 15, 2026
12 checks passed
@gianlucam76
gianlucam76 deleted the ginkgo-helmchart-outdated-tests branch October 15, 2026 12:09
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.

1 participant