diff --git a/cli/internal/operator/ssa/apply_test.go b/cli/internal/operator/ssa/apply_test.go index 856ae04..0fdda40 100644 --- a/cli/internal/operator/ssa/apply_test.go +++ b/cli/internal/operator/ssa/apply_test.go @@ -50,10 +50,12 @@ func TestVersionFromEmbeddedChartMatchesChartAppVersion(t *testing.T) { version, err := versionFromObjects(objs) require.NoError(t, err) - // Tracks charts/yacd/Chart.yaml appVersion; bump alongside an operator - // release re-sync. This is the tripwire that the embedded chart copy is in - // sync with the pinned release. - assert.Equal(t, "v0.2.0", version) + // The rendered manager version (read from the Deployment's version label, + // set by the chart template) must equal the embedded chart's declared + // appVersion, so the install advertises the chart it actually ships. Reading + // the appVersion instead of a hardcoded literal keeps this green across + // releases while still catching template-wiring drift. + assert.Equal(t, embeddedChartAppVersion(t), version) assert.True(t, semver.IsValid(version), "embedded version must be valid semver") } diff --git a/cli/internal/operator/ssa/install_envtest_test.go b/cli/internal/operator/ssa/install_envtest_test.go index 2c61bb5..b8a8c39 100644 --- a/cli/internal/operator/ssa/install_envtest_test.go +++ b/cli/internal/operator/ssa/install_envtest_test.go @@ -51,7 +51,7 @@ func TestEnsureOperatorInstallsFromEmbeddedChart(t *testing.T) { require.NoError(t, err) assert.True(t, state.Installed, "manager Deployment should exist") - assert.Equal(t, "v0.2.0", state.Version, "version read from the manager Deployment label") + assert.Equal(t, embeddedChartAppVersion(t), state.Version, "version read from the manager Deployment label") // envtest has no kube-controller-manager, so the Deployment never becomes // Available; live readiness is proven by the P6 k3d e2e, not here. assert.False(t, state.Ready, "envtest cannot make a Deployment Available") @@ -86,7 +86,7 @@ func TestEnsureOperatorIsIdempotent(t *testing.T) { state, err := inst.EnsureOperator(ctx, operator.InstallSpec{}) require.NoError(t, err, "re-apply of an equal version must be a no-op") assert.True(t, state.Installed) - assert.Equal(t, "v0.2.0", state.Version) + assert.Equal(t, embeddedChartAppVersion(t), state.Version) } func TestEnsureOperatorPrunesStrayManagedObject(t *testing.T) { @@ -144,7 +144,7 @@ func TestPlanOnEmptyClusterReportsInstallAndMutatesNothing(t *testing.T) { decision, err := inst.Plan(ctx, operator.InstallSpec{}) require.NoError(t, err) assert.Equal(t, operator.ActionInstall, decision.Action) - assert.Equal(t, "v0.2.0", decision.TargetVersion) + assert.Equal(t, embeddedChartAppVersion(t), decision.TargetVersion) assert.Empty(t, decision.InstalledVersion, "nothing is installed yet") // And it applied nothing: no manager Deployment and no CRD exist afterward. @@ -173,7 +173,7 @@ func TestPlanRefusesNewerInstalledVersionWithoutMutating(t *testing.T) { require.ErrorIs(t, err, operator.ErrNewerOperator) assert.Equal(t, operator.ActionRefuse, decision.Action) assert.Equal(t, "v0.9.9", decision.InstalledVersion) - assert.Equal(t, "v0.2.0", decision.TargetVersion) + assert.Equal(t, embeddedChartAppVersion(t), decision.TargetVersion) // Plan did not touch the seeded Deployment: its version label still reads the // newer value, proving Plan never re-applied the embedded manifest set. @@ -227,7 +227,7 @@ func TestEnsureOperatorNamespaceFlexibility(t *testing.T) { state, err := inst.EnsureOperator(ctx, operator.InstallSpec{Namespace: ns}) require.NoError(t, err) assert.True(t, state.Installed) - assert.Equal(t, "v0.2.0", state.Version) + assert.Equal(t, embeddedChartAppVersion(t), state.Version) // Namespaced objects land in the requested namespace. deployment := &appsv1.Deployment{}