diff --git a/test/extended/machine_config/helpers.go b/test/extended/machine_config/helpers.go index 43e93857bb04..fa975b5b0465 100644 --- a/test/extended/machine_config/helpers.go +++ b/test/extended/machine_config/helpers.go @@ -19,6 +19,7 @@ import ( machinev1beta1 "github.com/openshift/api/machine/v1beta1" mcfgv1 "github.com/openshift/api/machineconfiguration/v1" opv1 "github.com/openshift/api/operator/v1" + configv1client "github.com/openshift/client-go/config/clientset/versioned" machineclient "github.com/openshift/client-go/machine/clientset/versioned" machineconfigclient "github.com/openshift/client-go/machineconfiguration/clientset/versioned" mcopclient "github.com/openshift/client-go/operator/clientset/versioned" @@ -149,6 +150,34 @@ func skipOnMetal(oc *exutil.CLI) { } } +// `isFeatureGateEnabled` checks if the desired feature gate provided as a parameter is enabled in +// the test cluster. It returns true if the feature gate is enabled and false otherwise. +func isFeatureGateEnabled(configClient configv1client.Interface, featureGate osconfigv1.FeatureGateName) bool { + // Get the FeatureGates resource + fgs, err := configClient.ConfigV1().FeatureGates().Get(context.TODO(), "cluster", metav1.GetOptions{}) + o.Expect(err).NotTo(o.HaveOccurred(), "Error getting clsuter FeatureGates.") + + // Loop through the feature gates to see if the desired one is enabled + fgEnabled := false + for _, fg := range fgs.Status.FeatureGates { + for _, enabledFG := range fg.Enabled { + if enabledFG.Name == featureGate { + fgEnabled = true + break + } + } + } + return fgEnabled +} + +// `SkipWhenFeatureGateEnabled` skips a test if the desired feature gate provided as a parameter is +// enabled in the test cluster. +func SkipWhenFeatureGateEnabled(configClient configv1client.Interface, featureGate osconfigv1.FeatureGateName) { + if isFeatureGateEnabled(configClient, featureGate) { + e2eskipper.Skipf("Skipping this test since the `%v` FeatureGate is enabled.", featureGate) + } +} + // `GetRolesToTest` gets the MCPs in a cluster with nodes associated to it. This allows a more robust way to determine // the roles to use when selecting nodes and testing their MCP associations in an MCN. func GetRolesToTest(oc *exutil.CLI, machineConfigClient *machineconfigclient.Clientset) []string { diff --git a/test/extended/machine_config/machine_config_node.go b/test/extended/machine_config/machine_config_node.go index 441eea63237c..de2132206ac2 100644 --- a/test/extended/machine_config/machine_config_node.go +++ b/test/extended/machine_config/machine_config_node.go @@ -73,6 +73,10 @@ var _ = g.Describe("[sig-mco][OCPFeatureGate:MachineConfigNodes]", func() { }) g.It("[Serial]Should properly transition through MCN conditions on rebootless node update [apigroup:machineconfiguration.openshift.io]", func() { + // Skip this test when the `ImageModeStatusReporting` FeatureGate is enabled, since its + // regression tests handle the different conditions list. + SkipWhenFeatureGateEnabled(oc.AdminConfigClient(), "ImageModeStatusReporting") + if IsSingleNode(oc) { ValidateMCNConditionTransitionsOnRebootlessUpdateSNO(oc, nodeDisruptionFixture, nodeDisruptionEmptyFixture, masterMCFixture) } else {