fix: repair ai lookup tests after helm fork api changes - #676
Merged
Conversation
The vendored Helm fork dropped pkg/chartutil and pkg/werf/helmopts, moved CoalesceValues to pkg/chart/common/util, and changed RenderWithClientProvider to take a context instead of HelmOptions, which left pkg/chart/lookup_ai_test.go unable to compile. Signed-off-by: Ilya Drey <ilya.drey@flant.com>
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
Updates
pkg/chart/lookup_ai_test.goto the current vendored Helm fork API so it compiles again. Test-only change: the fiveTestAI_LocalClientProvider*cases keep their templates, expected values and assertions — only imports, types and the render call site move to their new homes.Why
The file was written against an older layout of
pkg/helmand had gone stale, so the package failed to build:Three upstream-sync changes broke it:
pkg/helm/pkg/chartutilis gone —CoalesceValuesnow lives inpkg/helm/pkg/chart/common/util(chart/common/util/coalesce.go:49).pkg/helm/pkg/werf/helmoptswas removed outright; this test was the last reference to it anywhere in the repo.engine.RenderWithClientProvider(pkg/helm/pkg/engine/engine.go:124) now takescontext.Contextfirst and no longer takes ahelmopts.HelmOptionsargument.Key changes
pkg/chart/lookup_ai_test.gochartutil.CoalesceValues→chartcommonutil.CoalesceValues(pkg/helm/pkg/chart/common/util).engine.RenderWithClientProvider(c, vals, provider, helmopts.HelmOptions{})→helmengine.RenderWithClientProvider(context.Background(), c, vals, provider), in all five tests.Filetochartcommon.File, which is whatv2chart.Chart.Templatesis declared as (pkg/helm/pkg/chart/v2/chart.go:51); chart literals now usev2chart.Chart/v2chart.Metadata.pkg/chart/chart_render.go(v2chart,chartcommon,chartcommonutil,helmengine).//go:build ai_teststag, which had been dropped in the working tree. It matches the two sibling*_ai_test.gofiles in the package and the AGENTS.md rule for AI-written tests.No production code is touched, and
go mod tidyis a no-op — every import moved within this module.Verification
All 5 tests and 7 subtests pass.
task lint:golangci-lint paths="./pkg/chart/..." tags=ai_testsreports no new findings.Review focus / risks
pkg/helm/pkg/engine/engine_test.go:295-395exercises the same render path with the same expectations, which is the reference for why the untouched assertions (including themoby/templates/<name>output keys) remain valid.//go:build ai_testsrestored, these tests do not run in the defaulttask test:unit, so a future API break here goes unnoticed until someone runs with the tag. That is the existing convention for*_ai_test.go, but it is the one judgement call in this PR.testpackagefires on all three*_ai_test.gofiles inpkg/chart(they test unexported symbols such asnewLocalClientProvider, sochart_testis not an option), and awsl_v5whitespace complaint sits in the already-committedpkg/chart/chart_render.go:376.