From fb48dea1902c92cc8871ad9d0b5ae2ab0062e1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Burzy=C5=84ski?= Date: Wed, 5 Feb 2025 11:44:01 +0100 Subject: [PATCH] chore: fix e2e upgrade test - add missing effective semver (#1128) --- test/e2e/test_helm_install_upgrade.go | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/e2e/test_helm_install_upgrade.go b/test/e2e/test_helm_install_upgrade.go index 867457f6f..c6fee1c57 100644 --- a/test/e2e/test_helm_install_upgrade.go +++ b/test/e2e/test_helm_install_upgrade.go @@ -54,13 +54,16 @@ func TestHelmUpgrade(t *testing.T) { } testCases := []struct { - name string - fromVersion string - toVersion string - objectsToDeploy []client.Object - upgradeToCurrent bool - assertionsAfterInstall []assertion - assertionsAfterUpgrade []assertion + name string + fromVersion string + toVersion string + objectsToDeploy []client.Object + upgradeToCurrent bool + // If upgrading to an image tag that's not a valid semver, fill this to the effective semver so that charts + // can correctly render semver-conditional templates. + upgradeToEffectiveSemver string + assertionsAfterInstall []assertion + assertionsAfterUpgrade []assertion }{ { name: "upgrade from one before latest to latest minor", @@ -138,6 +141,9 @@ func TestHelmUpgrade(t *testing.T) { name: "upgrade from latest minor to current", fromVersion: "1.4.0", // renovate: datasource=docker packageName=kong/gateway-operator-oss upgradeToCurrent: true, + // This is the effective semver of a next release. It's needed for the chart to properly render + // semver-conditional templates. + upgradeToEffectiveSemver: "1.5.0", objectsToDeploy: []client.Object{ &operatorv1beta1.GatewayConfiguration{ ObjectMeta: metav1.ObjectMeta{ @@ -332,6 +338,10 @@ func TestHelmUpgrade(t *testing.T) { "anonymous_reports": "false", } + if tc.upgradeToEffectiveSemver != "" { + values["image.effectiveSemver"] = tc.upgradeToEffectiveSemver + } + opts := &helm.Options{ KubectlOptions: &k8s.KubectlOptions{ Namespace: e.Namespace.Name,