Skip to content

Commit a61cd40

Browse files
gcs278claude
andcommitted
Verify OSSM operator version changes after upgrade
Add pre/post upgrade check on the Subscription's status.installedCSV to detect when the OSSM operator InstallPlan approval flow fails. This catches the case where OLM generates an InstallPlan for the channel head (e.g. v3.3.3) but the CIO only approves plans matching its pinned version (e.g. v3.2.0), leaving the operator stuck on the old version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a12e95f commit a61cd40

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

test/extended/router/gatewayapi_upgrade.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ type GatewayAPIUpgradeTest struct {
2929
startedWithNoOLM bool // tracks if GatewayAPIWithoutOLM was enabled at start
3030
loadBalancerSupported bool
3131
managedDNS bool
32-
precheckErr error // error from Skip() to surface in Setup()
32+
preUpgradeCSV string // tracks the installedCSV before upgrade
33+
precheckErr error // error from Skip() to surface in Setup()
3334
}
3435

3536
func (t *GatewayAPIUpgradeTest) Name() string {
@@ -124,6 +125,13 @@ func (t *GatewayAPIUpgradeTest) Setup(ctx context.Context, f *e2e.Framework) {
124125
g.By("Validating OLM-based provisioning before upgrade")
125126
validateOLMBasedOSSM(t.oc, 20*time.Minute)
126127
e2e.Logf("GatewayAPI resources successfully created with OLM-based provisioning")
128+
129+
g.By("Recording pre-upgrade installedCSV")
130+
preCSV, err := t.oc.AsAdmin().Run("get").Args("-n", expectedSubscriptionNamespace, "subscription", expectedSubscriptionName, "-o=jsonpath={.status.installedCSV}").Output()
131+
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get pre-upgrade installedCSV")
132+
o.Expect(preCSV).NotTo(o.BeEmpty(), "Pre-upgrade installedCSV should not be empty")
133+
t.preUpgradeCSV = preCSV
134+
e2e.Logf("Pre-upgrade installedCSV: %s", t.preUpgradeCSV)
127135
} else {
128136
g.By("Validating CIO-based (NO-OLM) provisioning before upgrade")
129137
t.validateCIOProvisioning(ctx, false) // false = no migration occurred
@@ -176,6 +184,15 @@ func (t *GatewayAPIUpgradeTest) Test(ctx context.Context, f *e2e.Framework, done
176184
g.By("GatewayAPIWithoutOLM is disabled - validating OLM-based provisioning")
177185
// A shorter timeout here is because the resources should already exist post-upgrade state.
178186
validateOLMBasedOSSM(t.oc, 2*time.Minute)
187+
188+
if t.preUpgradeCSV != "" {
189+
g.By("Verifying installedCSV changed after upgrade")
190+
postCSV, csvErr := t.oc.AsAdmin().Run("get").Args("-n", expectedSubscriptionNamespace, "subscription", expectedSubscriptionName, "-o=jsonpath={.status.installedCSV}").Output()
191+
o.Expect(csvErr).NotTo(o.HaveOccurred(), "Failed to get post-upgrade installedCSV")
192+
o.Expect(postCSV).NotTo(o.BeEmpty(), "Post-upgrade installedCSV should not be empty")
193+
e2e.Logf("Post-upgrade installedCSV: %s (pre-upgrade was: %s)", postCSV, t.preUpgradeCSV)
194+
o.Expect(postCSV).NotTo(o.Equal(t.preUpgradeCSV), "installedCSV should have changed after upgrade, indicating the OSSM operator was upgraded via the InstallPlan approval flow")
195+
}
179196
}
180197

181198
g.By("Verifying HTTPRoute still exists and is accepted after upgrade")

0 commit comments

Comments
 (0)