Skip to content

Commit 83fe110

Browse files
pmeidaclaude
andauthored
test: pin func CLI version so config ci workflow test is deterministic (#4034)
The integration test asserted the generated workflow contains github.DefaultFuncCliVersion, but the command now sources the version from version.Kver (injected via -ldflags). On release-1.23 the branch's latest tag is knative-v1.23.1, so the emitted version did not match the compiled-in default (knative-v1.23.0) and the test failed. Pin version.Kver in the test so the output is independent of the build/branch. Signed-off-by: Matej Vašek <matejvasek@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d327dce commit 83fe110

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/config_ci_int_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"knative.dev/func/pkg/ci/github"
1919
fn "knative.dev/func/pkg/functions"
2020
fnTest "knative.dev/func/pkg/testing"
21+
"knative.dev/func/pkg/version"
2122
)
2223

2324
// START: Integration Tests
@@ -77,6 +78,13 @@ func TestNewConfigCICmd_CreatesGitHubWorkflowDirectory(t *testing.T) {
7778
}
7879

7980
func TestNewConfigCICmd_WritesWorkflowFileToFSWithCorrectYAMLStructure(t *testing.T) {
81+
// Pin the CLI version so the generated workflow is deterministic,
82+
// independent of the version injected via -ldflags at build time
83+
// (which varies with the branch's most recent git tag).
84+
prev := version.Kver
85+
version.Kver = github.DefaultFuncCliVersion
86+
t.Cleanup(func() { version.Kver = prev })
87+
8088
opts := defaultIntegrationOpts(t, nil)
8189

8290
err := runConfigCiCmdIntegration(t, opts)

0 commit comments

Comments
 (0)