Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/extended/machine_config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions test/extended/machine_config/machine_config_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down