Skip to content

Commit eb52c92

Browse files
Merge pull request #30505 from isabella-janssen/mco-1870
MCO-1870: Skip MCN condition transition test in clusters with `ImageModeStatusReporting` FeatureGate is enabled
2 parents 353bc51 + cda83de commit eb52c92

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

test/extended/machine_config/helpers.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
2020
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
2121
opv1 "github.com/openshift/api/operator/v1"
22+
configv1client "github.com/openshift/client-go/config/clientset/versioned"
2223
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
2324
machineconfigclient "github.com/openshift/client-go/machineconfiguration/clientset/versioned"
2425
mcopclient "github.com/openshift/client-go/operator/clientset/versioned"
@@ -149,6 +150,34 @@ func skipOnMetal(oc *exutil.CLI) {
149150
}
150151
}
151152

153+
// `isFeatureGateEnabled` checks if the desired feature gate provided as a parameter is enabled in
154+
// the test cluster. It returns true if the feature gate is enabled and false otherwise.
155+
func isFeatureGateEnabled(configClient configv1client.Interface, featureGate osconfigv1.FeatureGateName) bool {
156+
// Get the FeatureGates resource
157+
fgs, err := configClient.ConfigV1().FeatureGates().Get(context.TODO(), "cluster", metav1.GetOptions{})
158+
o.Expect(err).NotTo(o.HaveOccurred(), "Error getting clsuter FeatureGates.")
159+
160+
// Loop through the feature gates to see if the desired one is enabled
161+
fgEnabled := false
162+
for _, fg := range fgs.Status.FeatureGates {
163+
for _, enabledFG := range fg.Enabled {
164+
if enabledFG.Name == featureGate {
165+
fgEnabled = true
166+
break
167+
}
168+
}
169+
}
170+
return fgEnabled
171+
}
172+
173+
// `SkipWhenFeatureGateEnabled` skips a test if the desired feature gate provided as a parameter is
174+
// enabled in the test cluster.
175+
func SkipWhenFeatureGateEnabled(configClient configv1client.Interface, featureGate osconfigv1.FeatureGateName) {
176+
if isFeatureGateEnabled(configClient, featureGate) {
177+
e2eskipper.Skipf("Skipping this test since the `%v` FeatureGate is enabled.", featureGate)
178+
}
179+
}
180+
152181
// `GetRolesToTest` gets the MCPs in a cluster with nodes associated to it. This allows a more robust way to determine
153182
// the roles to use when selecting nodes and testing their MCP associations in an MCN.
154183
func GetRolesToTest(oc *exutil.CLI, machineConfigClient *machineconfigclient.Clientset) []string {

test/extended/machine_config/machine_config_node.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ var _ = g.Describe("[sig-mco][OCPFeatureGate:MachineConfigNodes]", func() {
7373
})
7474

7575
g.It("[Serial]Should properly transition through MCN conditions on rebootless node update [apigroup:machineconfiguration.openshift.io]", func() {
76+
// Skip this test when the `ImageModeStatusReporting` FeatureGate is enabled, since its
77+
// regression tests handle the different conditions list.
78+
SkipWhenFeatureGateEnabled(oc.AdminConfigClient(), "ImageModeStatusReporting")
79+
7680
if IsSingleNode(oc) {
7781
ValidateMCNConditionTransitionsOnRebootlessUpdateSNO(oc, nodeDisruptionFixture, nodeDisruptionEmptyFixture, masterMCFixture)
7882
} else {

0 commit comments

Comments
 (0)