Skip to content

Commit

Permalink
Ignore alerts on CustomNoUpgrade clusters
Browse files Browse the repository at this point in the history
This updates a helper function to check for both CustomNoUpgrade
and TechPreviewNoUpgrade when determining whether non-upgradeable
alerts should be ignored.
  • Loading branch information
patrickdillon committed Apr 1, 2024
1 parent 56867df commit e375d1c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 0 additions & 4 deletions test/extended/builds/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
})

g.JustBeforeEach(func() {
//TODO remove this check once https://github.com/openshift/cluster-storage-operator/pull/335 and https://github.com/openshift/openshift-controller-manager/pull/250 have merged
if !exutil.IsTechPreviewNoUpgrade(oc) {
g.Skip("the test is not expected to work within Tech Preview disabled clusters")
}
// create the secret to share in a new namespace
g.By("creating a secret")
err := oc.AsAdmin().Run("--namespace=default", "apply").Args("-f", secret).Execute()
Expand Down
4 changes: 2 additions & 2 deletions test/extended/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,8 @@ var _ = g.Describe("[sig-instrumentation] Prometheus [apigroup:image.openshift.i
allowedAlertNames = append(allowedAlertNames, alertTest.AlertName())
}

if exutil.IsTechPreviewNoUpgrade(oc) {
// On a TechPreviewNoUpgrade cluster we must ignore the TechPreviewNoUpgrade and ClusterNotUpgradeable alerts generated by the CVO.
if exutil.IsNoUpgradeFeatureSet(oc) {
// On a TechPreviewNoUpgrade or CustomNoUpgrade cluster we must ignore the TechPreviewNoUpgrade and ClusterNotUpgradeable alerts generated by the CVO.
// These two alerts are expected in this case when a cluster is configured to enable Tech Preview features,
// as they were intended to be "gentle reminders" to the cluster admins of the ramifications of enabling Tech Preview
allowedAlertNames = append(allowedAlertNames, "TechPreviewNoUpgrade", "ClusterNotUpgradeable")
Expand Down
4 changes: 0 additions & 4 deletions test/extended/storage/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ var _ = g.Describe("[sig-storage][Feature:CSIInlineVolumeAdmission][Serial]", fu
csiSharedRoleBinding = filepath.Join(baseDir, "csi-sharedresourcerolebinding.yaml")

beforeEach = func(oc *exutil.CLI) {
// TODO: remove this after the shared resource driver is GA
if !exutil.IsTechPreviewNoUpgrade(oc) {
g.Skip("this test is only expected to work with TechPreviewNoUpgrade clusters")
}
exutil.PreTestDump()

// create the secret to share in a new namespace
Expand Down
9 changes: 5 additions & 4 deletions test/extended/util/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -2083,17 +2083,18 @@ func SkipIfExternalControlplaneTopology(oc *CLI, reason string) {
}
}

// IsTechPreviewNoUpgrade checks if a cluster is a TechPreviewNoUpgrade cluster
func IsTechPreviewNoUpgrade(oc *CLI) bool {
// IsNoUpgradeFeatureSet checks if a cluster has a non-upgradeable featureset
// such as TechPreviewNoUpgrade or CustomNoUpgrade.
func IsNoUpgradeFeatureSet(oc *CLI) bool {
featureGate, err := oc.AdminConfigClient().ConfigV1().FeatureGates().Get(context.Background(), "cluster", metav1.GetOptions{})
if err != nil {
if kapierrs.IsNotFound(err) {
return false
}
e2e.Failf("could not retrieve feature-gate: %v", err)
}

return featureGate.Spec.FeatureSet == configv1.TechPreviewNoUpgrade
featureSet := featureGate.Spec.FeatureSet
return (featureSet == configv1.TechPreviewNoUpgrade || featureSet == configv1.CustomNoUpgrade)
}

// DoesApiResourceExist searches the list of ApiResources and returns "true" if a given
Expand Down

0 comments on commit e375d1c

Please sign in to comment.