Skip to content

Commit 1b893d5

Browse files
authored
Merge pull request #30072 from camilamacedo86/remove-olmv1
OPRUN-4055: [OLMv1] Remove olmv1.go tests since those has been executed by OTE
2 parents a0a320b + 4b0fe03 commit 1b893d5

File tree

3 files changed

+4
-211
lines changed

3 files changed

+4
-211
lines changed

test/extended/olm/olmv1.go

Lines changed: 4 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,26 @@
11
package operators
22

33
import (
4-
"context"
54
"encoding/json"
65
"fmt"
7-
"os"
8-
"path/filepath"
9-
"strings"
10-
"time"
11-
126
g "github.com/onsi/ginkgo/v2"
137
o "github.com/onsi/gomega"
8+
configv1 "github.com/openshift/api/config/v1"
9+
exutil "github.com/openshift/origin/test/extended/util"
1410
"k8s.io/apimachinery/pkg/api/meta"
1511
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1612
"k8s.io/apimachinery/pkg/util/rand"
17-
"k8s.io/apimachinery/pkg/util/wait"
18-
19-
configv1 "github.com/openshift/api/config/v1"
20-
exutil "github.com/openshift/origin/test/extended/util"
13+
"os"
14+
"strings"
2115
)
2216

2317
const (
24-
olmv1GroupName = "olm.operatorframework.io"
25-
typeIncompatibleOperatorsUpgradeable = "InstalledOLMOperatorsUpgradeable"
26-
reasonIncompatibleOperatorsInstalled = "IncompatibleOperatorsInstalled"
27-
2818
typeInstalled = "Installed"
2919
typeProgressing = "Progressing"
3020

3121
reasonRetrying = "Retrying"
3222
)
3323

34-
var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation", func() {
35-
defer g.GinkgoRecover()
36-
37-
var (
38-
baseDir = exutil.FixturePath("testdata", "olmv1")
39-
ceFile = filepath.Join(baseDir, "install-operator.yaml")
40-
)
41-
oc := exutil.NewCLI("openshift-operator-controller")
42-
43-
g.BeforeEach(func() {
44-
exutil.PreTestDump()
45-
})
46-
47-
g.AfterEach(func() {
48-
if g.CurrentSpecReport().Failed() {
49-
exutil.DumpPodLogsStartingWith("", oc)
50-
}
51-
})
52-
53-
g.It("should install a cluster extension", func(ctx g.SpecContext) {
54-
checkFeatureCapability(oc)
55-
56-
const (
57-
packageName = "quay-operator"
58-
version = "3.13.0"
59-
)
60-
61-
cleanup, unique := applyResourceFile(oc, packageName, version, "", ceFile)
62-
ceName := "install-test-ce-" + unique
63-
g.DeferCleanup(cleanup)
64-
65-
g.By("waiting for the ClusterExtention to be installed")
66-
var lastReason string
67-
err := wait.PollUntilContextTimeout(ctx, time.Second, 5*time.Minute, true,
68-
func(ctx context.Context) (bool, error) {
69-
b, err, s := waitForClusterExtensionReady(oc, ceName)
70-
if lastReason != s {
71-
g.GinkgoLogr.Info(fmt.Sprintf("waitForClusterExtensionReady: %q", s))
72-
lastReason = s
73-
}
74-
return b, err
75-
})
76-
o.Expect(lastReason).To(o.BeEmpty())
77-
o.Expect(err).NotTo(o.HaveOccurred())
78-
})
79-
80-
g.It("should fail to install a non-existing cluster extension", func(ctx g.SpecContext) {
81-
checkFeatureCapability(oc)
82-
83-
const (
84-
packageName = "does-not-exist"
85-
version = "99.99.99"
86-
)
87-
88-
cleanup, unique := applyResourceFile(oc, packageName, version, "", ceFile)
89-
ceName := "install-test-ce-" + unique
90-
g.DeferCleanup(cleanup)
91-
92-
g.By("waiting for the ClusterExtention to report failure")
93-
var lastReason string
94-
err := wait.PollUntilContextTimeout(ctx, time.Second, 5*time.Minute, true,
95-
func(ctx context.Context) (bool, error) {
96-
b, err, s := waitForClusterExtensionFailure(oc, ceName)
97-
if lastReason != s {
98-
g.GinkgoLogr.Info(fmt.Sprintf("waitForClusterExtensionFailure: %q", s))
99-
lastReason = s
100-
}
101-
return b, err
102-
})
103-
o.Expect(lastReason).To(o.BeEmpty())
104-
o.Expect(err).NotTo(o.HaveOccurred())
105-
})
106-
107-
g.It("should block cluster upgrades if an incompatible operator is installed", func(ctx g.SpecContext) {
108-
checkFeatureCapability(oc)
109-
110-
const (
111-
packageName = "cluster-logging"
112-
version = "6.2.2"
113-
)
114-
115-
cleanup, unique := applyResourceFile(oc, packageName, version, "", ceFile)
116-
ceName := "install-test-ce-" + unique
117-
g.DeferCleanup(cleanup)
118-
119-
g.By("waiting for the ClusterExtention to be installed")
120-
var lastReason string
121-
err := wait.PollUntilContextTimeout(ctx, time.Second, 5*time.Minute, true,
122-
func(ctx context.Context) (bool, error) {
123-
b, err, s := waitForClusterExtensionReady(oc, ceName)
124-
if lastReason != s {
125-
g.GinkgoLogr.Info(fmt.Sprintf("waitForClusterExtensionReady: %q", s))
126-
lastReason = s
127-
}
128-
return b, err
129-
})
130-
o.Expect(lastReason).To(o.BeEmpty())
131-
o.Expect(err).NotTo(o.HaveOccurred())
132-
133-
g.By("ensuring the cluster is not upgradeable when olm.maxopenshiftversion is specified")
134-
lastReason = ""
135-
err = wait.PollUntilContextTimeout(ctx, time.Second, 5*time.Minute, true,
136-
func(ctx context.Context) (bool, error) {
137-
b, err, s := waitForUpgradableCondition(oc, false, ceName)
138-
if lastReason != s {
139-
g.GinkgoLogr.Info(fmt.Sprintf("waitForUpgradableCondition: %q", s))
140-
lastReason = s
141-
}
142-
return b, err
143-
})
144-
o.Expect(lastReason).To(o.BeEmpty())
145-
o.Expect(err).NotTo(o.HaveOccurred())
146-
})
147-
})
148-
14924
// Use the supplied |unique| value if provided, otherwise generate a unique string. The unique string is returned.
15025
// |unique| is used to combine common test elements and to avoid duplicate names, which can occur if, for instance,
15126
// the packageName is used.
@@ -207,75 +82,6 @@ func waitForClusterExtensionReady(oc *exutil.CLI, ceName string) (bool, error, s
20782
return true, nil, ""
20883
}
20984

210-
func waitForClusterExtensionFailure(oc *exutil.CLI, ceName string) (bool, error, string) {
211-
var conditions []metav1.Condition
212-
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusterextensions.olm.operatorframework.io", ceName, "-o=jsonpath={.status.conditions}").Output()
213-
if err != nil {
214-
return false, err, ""
215-
}
216-
// no data yet, so try again
217-
if output == "" {
218-
return false, nil, "no output"
219-
}
220-
if err := json.Unmarshal([]byte(output), &conditions); err != nil {
221-
return false, fmt.Errorf("error in json.Unmarshal(%v): %v", output, err), ""
222-
}
223-
c := meta.FindStatusCondition(conditions, typeProgressing)
224-
if c == nil {
225-
return false, nil, fmt.Sprintf("condition not present: %q", typeProgressing)
226-
}
227-
if c.Status != metav1.ConditionTrue {
228-
return false, nil, fmt.Sprintf("expected status to be %q: %+v", metav1.ConditionTrue, c)
229-
}
230-
if !strings.HasPrefix(c.Message, "no bundles found") {
231-
return false, nil, fmt.Sprintf("expected message to contain %q: %+v", "no bundles found", c)
232-
}
233-
c = meta.FindStatusCondition(conditions, typeInstalled)
234-
if c == nil {
235-
return false, nil, fmt.Sprintf("condition not present: %q", typeInstalled)
236-
}
237-
if c.Status != metav1.ConditionFalse {
238-
return false, nil, fmt.Sprintf("expected status to be %q: %+v", metav1.ConditionFalse, c)
239-
}
240-
return true, nil, ""
241-
}
242-
243-
func waitForUpgradableCondition(oc *exutil.CLI, status bool, ceName string) (bool, error, string) {
244-
var conditions []metav1.Condition
245-
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("olms.operator.openshift.io", "cluster", "-o=jsonpath={.status.conditions}").Output()
246-
if err != nil {
247-
return false, err, ""
248-
}
249-
// no data yet, so try again
250-
if output == "" {
251-
return false, nil, "no output"
252-
}
253-
if err := json.Unmarshal([]byte(output), &conditions); err != nil {
254-
return false, fmt.Errorf("error in json.Unmarshal(%v): %v", output, err), ""
255-
}
256-
c := meta.FindStatusCondition(conditions, typeIncompatibleOperatorsUpgradeable)
257-
if c == nil {
258-
return false, nil, fmt.Sprintf("condition not present: %q", typeIncompatibleOperatorsUpgradeable)
259-
}
260-
if status {
261-
if c.Status != metav1.ConditionTrue {
262-
return false, nil, fmt.Sprintf("expected status to be %q: %+v", metav1.ConditionTrue, c)
263-
}
264-
return true, nil, ""
265-
}
266-
if c.Status != metav1.ConditionFalse {
267-
return false, nil, fmt.Sprintf("expected status to be %q: %+v", metav1.ConditionFalse, c)
268-
}
269-
if c.Reason != reasonIncompatibleOperatorsInstalled {
270-
return false, nil, fmt.Sprintf("expected reason to be %q: %+v", reasonIncompatibleOperatorsInstalled, c)
271-
}
272-
// Message should include "bundle %q for ClusterExtension %q"
273-
if !strings.Contains(c.Message, ceName) {
274-
return false, nil, fmt.Sprintf("expected message to contain %q: %+v", ceName, c)
275-
}
276-
return true, nil, ""
277-
}
278-
27985
func checkFeatureCapability(oc *exutil.CLI) {
28086
cap, err := exutil.IsCapabilityEnabled(oc, configv1.ClusterVersionCapabilityOperatorLifecycleManagerV1)
28187
o.Expect(err).NotTo(o.HaveOccurred())

test/extended/util/annotate/generated/zz_generated.annotations.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zz_generated.manifests/test-reporting.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -970,13 +970,6 @@ spec:
970970
Catalog should serve FBC via the /v1/api/all endpoint'
971971
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 openshift-redhat-operators
972972
Catalog should serve FBC via the /v1/api/all endpoint'
973-
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator
974-
installation should block cluster upgrades if an incompatible operator is
975-
installed'
976-
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator
977-
installation should fail to install a non-existing cluster extension'
978-
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator
979-
installation should install a cluster extension'
980973
- featureGate: NewOLMCatalogdAPIV1Metas
981974
tests:
982975
- testName: '[sig-olmv1][OCPFeatureGate:NewOLMCatalogdAPIV1Metas][Skipped:Disconnected]

0 commit comments

Comments
 (0)