Skip to content

Commit e4ffb11

Browse files
committed
Test now checks for OKD clusters that already have featureset enabled
1 parent ff1f899 commit e4ffb11

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

test/extended/apiserver/featuregate_okd.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,23 @@ var _ = g.Describe("[sig-api-machinery][Feature:FeatureGate][OCPFeatureGate:OKD]
4949
}
5050
}()
5151

52-
// 4. Attempt to set OKD featureset
53-
fg.Spec.FeatureSet = configv1.OKD
54-
_, err = fgClient.Update(context.Background(), fg, metav1.UpdateOptions{})
55-
56-
// 5. Validate based on cluster type
52+
// 4. Validate based on cluster type
5753
if okdCluster {
58-
// On OKD: should succeed
59-
o.Expect(err).NotTo(o.HaveOccurred(), "OKD featureset should be allowed on OKD clusters")
54+
// On OKD: OKD featureset should be allowed
55+
// Check if it's already set to OKD (which will be the default on OKD clusters)
56+
if originalFeatureSet == configv1.OKD {
57+
// Already set to OKD - this is expected and valid on OKD clusters
58+
o.Expect(originalFeatureSet).To(o.Equal(configv1.OKD), "OKD cluster should have OKD featureset")
59+
} else {
60+
// If not already OKD, attempt to set it and verify it's allowed
61+
fg.Spec.FeatureSet = configv1.OKD
62+
_, err = fgClient.Update(context.Background(), fg, metav1.UpdateOptions{})
63+
o.Expect(err).NotTo(o.HaveOccurred(), "OKD featureset should be allowed on OKD clusters")
64+
}
6065
} else {
6166
// On OCP: should be rejected
67+
fg.Spec.FeatureSet = configv1.OKD
68+
_, err = fgClient.Update(context.Background(), fg, metav1.UpdateOptions{})
6269
o.Expect(err).To(o.HaveOccurred(), "OKD featureset should be rejected on OCP clusters")
6370
o.Expect(err.Error()).To(o.ContainSubstring("OKD featureset is not supported on OpenShift clusters"))
6471
o.Expect(k8serrors.IsForbidden(err)).To(o.BeTrue(), "Error should be a Forbidden error")

0 commit comments

Comments
 (0)