Skip to content

Commit 17c699a

Browse files
committed
NO-JIRA: replace hardcoded ClusterVersionCapability string in olmv1 tests
Value was previously hardcoded. Can be replaced now since openshift/api has been bumped and has the `configv1.ClusterVersionCapabilityOperatorLifecycleManagerV1` constant. Signed-off-by: Anik Bhattacharjee <[email protected]>
1 parent 585968f commit 17c699a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/extended/olm/olmv1.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1616
"k8s.io/apimachinery/pkg/util/wait"
1717

18+
configv1 "github.com/openshift/api/config/v1"
1819
exutil "github.com/openshift/origin/test/extended/util"
1920
)
2021

@@ -34,7 +35,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 CRDs", func() {
3435
oc := exutil.NewCLIWithoutNamespace("default")
3536

3637
g.It("should be installed", func(ctx g.SpecContext) {
37-
checkFeatureCapability(ctx, oc)
38+
checkFeatureCapability(oc)
3839

3940
providedAPIs := []struct {
4041
group string
@@ -76,7 +77,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLM
7677
oc := exutil.NewCLIWithoutNamespace("default")
7778

7879
g.It("should be installed", func(ctx g.SpecContext) {
79-
checkFeatureCapability(ctx, oc)
80+
checkFeatureCapability(oc)
8081

8182
providedCatalogs := []string{
8283
"openshift-certified-operators",
@@ -123,7 +124,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLM
123124
})
124125

125126
g.It("should fail to install if it has an invalid reference", func(ctx g.SpecContext) {
126-
checkFeatureCapability(ctx, oc)
127+
checkFeatureCapability(oc)
127128

128129
g.By("applying the necessary resources")
129130
err := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", catFile).Execute()
@@ -165,7 +166,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLM
165166
})
166167

167168
g.It("should install a cluster extension", func(ctx g.SpecContext) {
168-
checkFeatureCapability(ctx, oc)
169+
checkFeatureCapability(oc)
169170

170171
const (
171172
packageName = "quay-operator"
@@ -191,7 +192,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLM
191192
})
192193

193194
g.It("should fail to install a non-existing cluster extension", func(ctx g.SpecContext) {
194-
checkFeatureCapability(ctx, oc)
195+
checkFeatureCapability(oc)
195196

196197
const (
197198
packageName = "does-not-exist"
@@ -217,7 +218,7 @@ var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLM
217218
})
218219

219220
g.It("should block cluster upgrades if an incompatible operator is installed", func(ctx g.SpecContext) {
220-
checkFeatureCapability(ctx, oc)
221+
checkFeatureCapability(oc)
221222

222223
const (
223224
packageName = "elasticsearch-operator"
@@ -409,11 +410,8 @@ func waitForCatalogFailure(oc *exutil.CLI, name string) (bool, error, string) {
409410
return true, nil, ""
410411
}
411412

412-
func checkFeatureCapability(ctx context.Context, oc *exutil.CLI) {
413-
// Hardcoded until openshift/api is updated:
414-
// import ( configv1 "github.com/openshift/api/config/v1" )
415-
// configv1.ClusterVersionCapabilityOperatorLifecycleManagerV1
416-
cap, err := exutil.IsCapabilityEnabled(oc, "OperatorLifecycleManagerV1")
413+
func checkFeatureCapability(oc *exutil.CLI) {
414+
cap, err := exutil.IsCapabilityEnabled(oc, configv1.ClusterVersionCapabilityOperatorLifecycleManagerV1)
417415
o.Expect(err).NotTo(o.HaveOccurred())
418416
if !cap {
419417
g.Skip("Test only runs with OperatorLifecycleManagerV1 capability")

0 commit comments

Comments
 (0)