Skip to content

Commit 54b6ab2

Browse files
committed
remove e2e catalog reconcile test
Signed-off-by: Ankita Thomas <[email protected]>
1 parent 4f8da4a commit 54b6ab2

File tree

3 files changed

+14
-92
lines changed

3 files changed

+14
-92
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ require (
4848
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4949
github.com/modern-go/reflect2 v1.0.2 // indirect
5050
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
51-
github.com/operator-framework/api v0.17.3 // indirect
5251
github.com/pkg/errors v0.9.1 // indirect
5352
github.com/prometheus/client_golang v1.14.0 // indirect
5453
github.com/prometheus/client_model v0.3.0 // indirect

internal/controllers/operator_controller_test.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import (
1212
catalogd "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1"
1313
"github.com/operator-framework/deppy/pkg/deppy"
1414
"github.com/operator-framework/deppy/pkg/deppy/input"
15+
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
16+
"github.com/operator-framework/operator-controller/internal/conditionsets"
17+
"github.com/operator-framework/operator-controller/internal/controllers"
18+
"github.com/operator-framework/operator-controller/internal/resolution"
1519
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
1620
apimeta "k8s.io/apimachinery/pkg/api/meta"
1721
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -22,11 +26,6 @@ import (
2226
"sigs.k8s.io/controller-runtime/pkg/client"
2327
"sigs.k8s.io/controller-runtime/pkg/client/fake"
2428
"sigs.k8s.io/controller-runtime/pkg/log"
25-
26-
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
27-
"github.com/operator-framework/operator-controller/internal/conditionsets"
28-
"github.com/operator-framework/operator-controller/internal/controllers"
29-
"github.com/operator-framework/operator-controller/internal/resolution"
3029
)
3130

3231
var _ = Describe("Operator Controller Test", func() {
@@ -1062,7 +1061,7 @@ var _ = Describe("Operator Controller Test", func() {
10621061
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
10631062
}
10641063
logCount = len(testLogs)
1065-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1064+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
10661065
})
10671066

10681067
It("reconciles all affected operators on cluster", func() {
@@ -1072,36 +1071,36 @@ var _ = Describe("Operator Controller Test", func() {
10721071
Expect(err).To(BeNil())
10731072
Eventually(func(g Gomega) {
10741073
By("verifying operator reconcile logs on catalog create")
1075-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1074+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
10761075
for _, p := range opNames {
10771076
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
10781077
}
10791078
logCount = len(testLogs)
1080-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1079+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
10811080

10821081
By("updating a catalog")
10831082
catalog.Spec.Source.Image.Ref = "s"
10841083
err = cl.Update(ctx, catalog)
10851084
Expect(err).To(BeNil())
10861085
Eventually(func(g Gomega) {
10871086
By("verifying operator reconcile logs on catalog update")
1088-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1087+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
10891088
for _, p := range opNames {
10901089
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
10911090
}
10921091
logCount = len(testLogs)
1093-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1092+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
10941093

10951094
By("deleting a catalog")
10961095
err = cl.Delete(ctx, catalog)
10971096
Expect(err).To(BeNil())
10981097
Eventually(func(g Gomega) {
10991098
By("verifying operator reconcile logs on catalog delete")
1100-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1099+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
11011100
for _, p := range opNames {
11021101
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
11031102
}
1104-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1103+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
11051104
})
11061105
AfterEach(func() {
11071106
for _, p := range opNames {

test/e2e/install_test.go

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
catalogd "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1"
1111
operatorv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
1212
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
13-
"k8s.io/apimachinery/pkg/api/errors"
1413
apimeta "k8s.io/apimachinery/pkg/api/meta"
1514
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1615
"k8s.io/apimachinery/pkg/types"
@@ -58,8 +57,6 @@ var _ = Describe("Operator Install", func() {
5857
},
5958
},
6059
}
61-
})
62-
It("resolves the specified package with correct bundle path", func() {
6360
err := c.Create(ctx, operatorCatalog)
6461
Expect(err).ToNot(HaveOccurred())
6562
Eventually(func(g Gomega) {
@@ -72,9 +69,10 @@ var _ = Describe("Operator Install", func() {
7269
g.Expect(cond.Reason).To(Equal(catalogd.ReasonUnpackSuccessful))
7370
g.Expect(cond.Message).To(ContainSubstring("successfully unpacked the catalog image"))
7471
}).WithTimeout(5 * time.Minute).WithPolling(defaultPoll).Should(Succeed())
75-
72+
})
73+
It("resolves the specified package with correct bundle path", func() {
7674
By("creating the Operator resource")
77-
err = c.Create(ctx, operator)
75+
err := c.Create(ctx, operator)
7876
Expect(err).ToNot(HaveOccurred())
7977

8078
By("eventually reporting a successful resolution and bundle path")
@@ -115,86 +113,12 @@ var _ = Describe("Operator Install", func() {
115113
g.Expect(cond.Reason).To(Equal(rukpakv1alpha1.ReasonInstallationSucceeded))
116114
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed())
117115
})
118-
It("resolves again when a new catalog is available", func() {
119-
Eventually(func(g Gomega) {
120-
// target package should not be present on cluster
121-
err := c.Get(ctx, types.NamespacedName{Name: pkgName}, &catalogd.Package{})
122-
Expect(errors.IsNotFound(err)).To(BeTrue())
123-
}).WithTimeout(5 * time.Minute).WithPolling(defaultPoll).Should(Succeed())
124-
125-
By("creating the Operator resource")
126-
err := c.Create(ctx, operator)
127-
Expect(err).ToNot(HaveOccurred())
128-
129-
By("failing to find Operator during resolution")
130-
Eventually(func(g Gomega) {
131-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
132-
g.Expect(err).ToNot(HaveOccurred())
133-
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
134-
g.Expect(cond).ToNot(BeNil())
135-
g.Expect(cond.Status).To(Equal(metav1.ConditionFalse))
136-
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonResolutionFailed))
137-
g.Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' not found", pkgName)))
138-
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed())
139-
140-
By("creating an Operator catalog with the desired package")
141-
err = c.Create(ctx, operatorCatalog)
142-
Expect(err).ToNot(HaveOccurred())
143-
Eventually(func(g Gomega) {
144-
err = c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, operatorCatalog)
145-
g.Expect(err).ToNot(HaveOccurred())
146-
cond := apimeta.FindStatusCondition(operatorCatalog.Status.Conditions, catalogd.TypeUnpacked)
147-
g.Expect(cond).ToNot(BeNil())
148-
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
149-
g.Expect(cond.Reason).To(Equal(catalogd.ReasonUnpackSuccessful))
150-
}).WithTimeout(5 * time.Minute).WithPolling(defaultPoll).Should(Succeed())
151-
152-
By("eventually resolving the package successfully")
153-
Eventually(func(g Gomega) {
154-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
155-
g.Expect(err).ToNot(HaveOccurred())
156-
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
157-
g.Expect(cond).ToNot(BeNil())
158-
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
159-
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonSuccess))
160-
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed())
161-
})
162116
AfterEach(func() {
163117
err := c.Delete(ctx, operator)
164118
Expect(err).ToNot(HaveOccurred())
165-
Eventually(func(g Gomega) {
166-
err = c.Get(ctx, types.NamespacedName{Name: operatorName}, &operatorv1alpha1.Operator{})
167-
Expect(errors.IsNotFound(err)).To(BeTrue())
168-
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed())
169119

170120
err = c.Delete(ctx, operatorCatalog)
171121
Expect(err).ToNot(HaveOccurred())
172-
Eventually(func(g Gomega) {
173-
err = c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, &catalogd.Catalog{})
174-
Expect(errors.IsNotFound(err)).To(BeTrue())
175-
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed())
176-
177-
// speed up delete without waiting for gc
178-
err = c.DeleteAllOf(ctx, &catalogd.BundleMetadata{})
179-
Expect(err).ToNot(HaveOccurred())
180-
err = c.DeleteAllOf(ctx, &catalogd.Package{})
181-
Expect(err).ToNot(HaveOccurred())
182-
183-
Eventually(func(g Gomega) {
184-
// ensure resource cleanup
185-
packages := &catalogd.PackageList{}
186-
err = c.List(ctx, packages)
187-
Expect(err).To(BeNil())
188-
Expect(packages.Items).To(BeEmpty())
189-
190-
bmd := &catalogd.BundleMetadataList{}
191-
err = c.List(ctx, bmd)
192-
Expect(err).To(BeNil())
193-
Expect(bmd.Items).To(BeEmpty())
194-
195-
err = c.Get(ctx, types.NamespacedName{Name: operatorName}, &rukpakv1alpha1.BundleDeployment{})
196-
Expect(errors.IsNotFound(err)).To(BeTrue())
197-
}).WithTimeout(5 * time.Minute).WithPolling(defaultPoll).Should(Succeed())
198122
})
199123
})
200124
})

0 commit comments

Comments
 (0)