Skip to content

fix: repair ai lookup tests after helm fork api changes - #676

Merged
drey merged 1 commit into
2from
fix/ai-test-dependencies
Jul 31, 2026
Merged

fix: repair ai lookup tests after helm fork api changes#676
drey merged 1 commit into
2from
fix/ai-test-dependencies

Conversation

@drey

@drey drey commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates pkg/chart/lookup_ai_test.go to the current vendored Helm fork API so it compiles again. Test-only change: the five TestAI_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/helm and had gone stale, so the package failed to build:

pkg/chart/lookup_ai_test.go:11:2: no required module provides package
  github.com/werf/nelm/pkg/helm/pkg/chartutil

Three upstream-sync changes broke it:

  • pkg/helm/pkg/chartutil is gone — CoalesceValues now lives in pkg/helm/pkg/chart/common/util (chart/common/util/coalesce.go:49).
  • pkg/helm/pkg/werf/helmopts was removed outright; this test was the last reference to it anywhere in the repo.
  • engine.RenderWithClientProvider (pkg/helm/pkg/engine/engine.go:124) now takes context.Context first and no longer takes a helmopts.HelmOptions argument.

Key changes

pkg/chart/lookup_ai_test.go

  • chartutil.CoalesceValueschartcommonutil.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.
  • Chart templates retyped from a chart-package-local File to chartcommon.File, which is what v2chart.Chart.Templates is declared as (pkg/helm/pkg/chart/v2/chart.go:51); chart literals now use v2chart.Chart / v2chart.Metadata.
  • Import aliases aligned with pkg/chart/chart_render.go (v2chart, chartcommon, chartcommonutil, helmengine).
  • Restored the //go:build ai_tests tag, which had been dropped in the working tree. It matches the two sibling *_ai_test.go files in the package and the AGENTS.md rule for AI-written tests.

No production code is touched, and go mod tidy is a no-op — every import moved within this module.

Verification

task test:go-test paths="./pkg/chart" tags=ai_tests -- -run TestAI_LocalClientProvider -v

All 5 tests and 7 subtests pass. task lint:golangci-lint paths="./pkg/chart/..." tags=ai_tests reports no new findings.

Review focus / risks

  • Low risk overall — test-only, and pkg/helm/pkg/engine/engine_test.go:295-395 exercises the same render path with the same expectations, which is the reference for why the untouched assertions (including the moby/templates/<name> output keys) remain valid.
  • Confirm the build tag should stay on. With //go:build ai_tests restored, these tests do not run in the default task 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.
  • Pre-existing lint findings left alone as out of scope: testpackage fires on all three *_ai_test.go files in pkg/chart (they test unexported symbols such as newLocalClientProvider, so chart_test is not an option), and a wsl_v5 whitespace complaint sits in the already-committed pkg/chart/chart_render.go:376.

Review in cubic

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>
@drey
drey merged commit 2a29517 into 2 Jul 31, 2026
8 checks passed
@drey
drey deleted the fix/ai-test-dependencies branch July 31, 2026 17:03
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