Skip to content

Commit 48b3c3f

Browse files
committed
remove e2e catalog reconcile test
Signed-off-by: Ankita Thomas <[email protected]>
1 parent 0ed3ede commit 48b3c3f

File tree

3 files changed

+28
-68
lines changed

3 files changed

+28
-68
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/go-logr/logr/funcr"
1010
. "github.com/onsi/ginkgo/v2"
1111
. "github.com/onsi/gomega"
12-
catalogd "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1"
12+
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
1313
"github.com/operator-framework/deppy/pkg/deppy"
1414
"github.com/operator-framework/deppy/pkg/deppy/input"
1515
"github.com/operator-framework/deppy/pkg/deppy/solver"
@@ -1101,7 +1101,7 @@ var _ = Describe("Operator Controller Test", func() {
11011101
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
11021102
}
11031103
logCount = len(testLogs)
1104-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1104+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
11051105
})
11061106

11071107
It("reconciles all affected operators on cluster", func() {
@@ -1111,36 +1111,36 @@ var _ = Describe("Operator Controller Test", func() {
11111111
Expect(err).To(BeNil())
11121112
Eventually(func(g Gomega) {
11131113
By("verifying operator reconcile logs on catalog create")
1114-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1114+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
11151115
for _, p := range opNames {
11161116
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
11171117
}
11181118
logCount = len(testLogs)
1119-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1119+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
11201120

11211121
By("updating a catalog")
11221122
catalog.Spec.Source.Image.Ref = "s"
11231123
err = cl.Update(ctx, catalog)
11241124
Expect(err).To(BeNil())
11251125
Eventually(func(g Gomega) {
11261126
By("verifying operator reconcile logs on catalog update")
1127-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1127+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
11281128
for _, p := range opNames {
11291129
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
11301130
}
11311131
logCount = len(testLogs)
1132-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1132+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
11331133

11341134
By("deleting a catalog")
11351135
err = cl.Delete(ctx, catalog)
11361136
Expect(err).To(BeNil())
11371137
Eventually(func(g Gomega) {
11381138
By("verifying operator reconcile logs on catalog delete")
1139-
g.Expect(len(testLogs)).To(Equal(logCount + len(opNames)))
1139+
g.Expect(testLogs).To(HaveLen(logCount + len(opNames)))
11401140
for _, p := range opNames {
11411141
g.Expect(testLogs[len(testLogs)-len(opNames):]).To(ContainElement(ContainSubstring(fmt.Sprintf("\"Operator\"={\"name\":\"%s\"}", p))))
11421142
}
1143-
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).WithArguments().Should(Succeed())
1143+
}).WithTimeout(2 * time.Second).WithPolling(1 * time.Second).Should(Succeed())
11441144
})
11451145
AfterEach(func() {
11461146
for _, p := range opNames {

test/e2e/install_test.go

Lines changed: 20 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
9-
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
109
operatorv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
1110
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
1211
"k8s.io/apimachinery/pkg/api/errors"
@@ -45,7 +44,6 @@ var _ = Describe("Operator Install", func() {
4544
By("eventually reporting a successful resolution and bundle path")
4645
Eventually(func(g Gomega) {
4746
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
48-
g.Expect(len(operator.Status.Conditions)).To(Equal(2))
4947
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
5048
g.Expect(cond).ToNot(BeNil())
5149
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
@@ -66,9 +64,16 @@ var _ = Describe("Operator Install", func() {
6664

6765
bd := rukpakv1alpha1.BundleDeployment{}
6866
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)).To(Succeed())
69-
g.Expect(len(bd.Status.Conditions)).To(Equal(2))
70-
g.Expect(bd.Status.Conditions[0].Reason).To(Equal("UnpackSuccessful"))
71-
g.Expect(bd.Status.Conditions[1].Reason).To(Equal("InstallationSucceeded"))
67+
68+
cond = apimeta.FindStatusCondition(bd.Status.Conditions, rukpakv1alpha1.TypeHasValidBundle)
69+
g.Expect(cond).ToNot(BeNil())
70+
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
71+
g.Expect(cond.Reason).To(Equal(rukpakv1alpha1.ReasonUnpackSuccessful))
72+
73+
cond = apimeta.FindStatusCondition(bd.Status.Conditions, rukpakv1alpha1.TypeInstalled)
74+
g.Expect(cond).ToNot(BeNil())
75+
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
76+
g.Expect(cond.Reason).To(Equal(rukpakv1alpha1.ReasonInstallationSucceeded))
7277
}).Should(Succeed())
7378
})
7479
})
@@ -86,7 +91,6 @@ var _ = Describe("Operator Install", func() {
8691
By("eventually reporting a successful resolution and bundle path")
8792
Eventually(func(g Gomega) {
8893
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
89-
g.Expect(len(operator.Status.Conditions)).To(Equal(2))
9094
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
9195
g.Expect(cond).ToNot(BeNil())
9296
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
@@ -107,63 +111,20 @@ var _ = Describe("Operator Install", func() {
107111

108112
bd := rukpakv1alpha1.BundleDeployment{}
109113
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)).To(Succeed())
110-
g.Expect(len(bd.Status.Conditions)).To(Equal(2))
111-
g.Expect(bd.Status.Conditions[0].Reason).To(Equal("UnpackSuccessful"))
112-
g.Expect(bd.Status.Conditions[1].Reason).To(Equal("InstallationSucceeded"))
113-
}).Should(Succeed())
114-
})
115-
})
116-
117-
It("resolves again when a new catalog is available", func() {
118-
pkgName := "prometheus"
119-
operator.Spec = operatorv1alpha1.OperatorSpec{
120-
PackageName: pkgName,
121-
}
122-
123-
// Delete the catalog first
124-
Expect(c.Delete(ctx, operatorCatalog)).To(Succeed())
125-
126-
Eventually(func(g Gomega) {
127-
// target package should not be present on cluster
128-
err := c.Get(ctx, types.NamespacedName{Name: pkgName}, &catalogd.Package{})
129-
g.Expect(errors.IsNotFound(err)).To(BeTrue())
130-
}).Should(Succeed())
131-
132-
By("creating the Operator resource")
133-
Expect(c.Create(ctx, operator)).To(Succeed())
134114

135-
By("failing to find Operator during resolution")
136-
Eventually(func(g Gomega) {
137-
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
138-
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
139-
g.Expect(cond).ToNot(BeNil())
140-
g.Expect(cond.Status).To(Equal(metav1.ConditionFalse))
141-
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonResolutionFailed))
142-
g.Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' not found", pkgName)))
143-
}).Should(Succeed())
115+
cond = apimeta.FindStatusCondition(bd.Status.Conditions, rukpakv1alpha1.TypeHasValidBundle)
116+
g.Expect(cond).ToNot(BeNil())
117+
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
118+
g.Expect(cond.Reason).To(Equal(rukpakv1alpha1.ReasonUnpackSuccessful))
144119

145-
By("creating an Operator catalog with the desired package")
146-
var err error
147-
operatorCatalog, err = createTestCatalog(ctx, testCatalogName, testCatalogRef)
148-
Expect(err).ToNot(HaveOccurred())
149-
Eventually(func(g Gomega) {
150-
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, operatorCatalog)).To(Succeed())
151-
cond := apimeta.FindStatusCondition(operatorCatalog.Status.Conditions, catalogd.TypeUnpacked)
152-
g.Expect(cond).ToNot(BeNil())
153-
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
154-
g.Expect(cond.Reason).To(Equal(catalogd.ReasonUnpackSuccessful))
155-
}).Should(Succeed())
120+
cond = apimeta.FindStatusCondition(bd.Status.Conditions, rukpakv1alpha1.TypeInstalled)
121+
g.Expect(cond).ToNot(BeNil())
122+
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
123+
g.Expect(cond.Reason).To(Equal(rukpakv1alpha1.ReasonInstallationSucceeded))
156124

157-
By("eventually resolving the package successfully")
158-
Eventually(func(g Gomega) {
159-
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
160-
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
161-
g.Expect(cond).ToNot(BeNil())
162-
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
163-
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonSuccess))
164-
}).Should(Succeed())
125+
}).Should(Succeed())
126+
})
165127
})
166-
167128
AfterEach(func() {
168129
Expect(c.Delete(ctx, operator)).To(Succeed())
169130
Eventually(func(g Gomega) {

0 commit comments

Comments
 (0)