Skip to content

Commit 040d8a5

Browse files
committed
address review comments
Signed-off-by: Bryce Palmer <[email protected]>
1 parent 4a9adbc commit 040d8a5

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

test/e2e/install_test.go

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ var _ = Describe("Operator Install", func() {
4040
})
4141
It("resolves the specified package with correct bundle path", func() {
4242
By("creating the Operator resource")
43-
err := c.Create(ctx, operator)
44-
Expect(err).ToNot(HaveOccurred())
43+
Expect(c.Create(ctx, operator)).To(Succeed())
4544

4645
By("eventually reporting a successful resolution and bundle path")
4746
Eventually(func(g Gomega) {
48-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
49-
g.Expect(err).ToNot(HaveOccurred())
47+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
5048
g.Expect(len(operator.Status.Conditions)).To(Equal(2))
5149
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
5250
g.Expect(cond).ToNot(BeNil())
@@ -58,17 +56,16 @@ var _ = Describe("Operator Install", func() {
5856

5957
By("eventually installing the package successfully")
6058
Eventually(func(g Gomega) {
61-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
62-
g.Expect(err).ToNot(HaveOccurred())
59+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
6360
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeInstalled)
6461
g.Expect(cond).ToNot(BeNil())
6562
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
6663
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonSuccess))
6764
g.Expect(cond.Message).To(ContainSubstring("installed from"))
6865
g.Expect(operator.Status.InstalledBundleResource).ToNot(BeEmpty())
66+
6967
bd := rukpakv1alpha1.BundleDeployment{}
70-
err = c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)
71-
g.Expect(err).ToNot(HaveOccurred())
68+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)).To(Succeed())
7269
g.Expect(len(bd.Status.Conditions)).To(Equal(2))
7370
g.Expect(bd.Status.Conditions[0].Reason).To(Equal("UnpackSuccessful"))
7471
g.Expect(bd.Status.Conditions[1].Reason).To(Equal("InstallationSucceeded"))
@@ -84,13 +81,11 @@ var _ = Describe("Operator Install", func() {
8481
})
8582
It("resolves the specified package with correct bundle path", func() {
8683
By("creating the Operator resource")
87-
err := c.Create(ctx, operator)
88-
Expect(err).ToNot(HaveOccurred())
84+
Expect(c.Create(ctx, operator)).To(Succeed())
8985

9086
By("eventually reporting a successful resolution and bundle path")
9187
Eventually(func(g Gomega) {
92-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
93-
g.Expect(err).ToNot(HaveOccurred())
88+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
9489
g.Expect(len(operator.Status.Conditions)).To(Equal(2))
9590
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
9691
g.Expect(cond).ToNot(BeNil())
@@ -102,17 +97,16 @@ var _ = Describe("Operator Install", func() {
10297

10398
By("eventually installing the package successfully")
10499
Eventually(func(g Gomega) {
105-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
106-
g.Expect(err).ToNot(HaveOccurred())
100+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
107101
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeInstalled)
108102
g.Expect(cond).ToNot(BeNil())
109103
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
110104
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonSuccess))
111105
g.Expect(cond.Message).To(ContainSubstring("installed from"))
112106
g.Expect(operator.Status.InstalledBundleResource).ToNot(BeEmpty())
107+
113108
bd := rukpakv1alpha1.BundleDeployment{}
114-
err = c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)
115-
g.Expect(err).ToNot(HaveOccurred())
109+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorName}, &bd)).To(Succeed())
116110
g.Expect(len(bd.Status.Conditions)).To(Equal(2))
117111
g.Expect(bd.Status.Conditions[0].Reason).To(Equal("UnpackSuccessful"))
118112
g.Expect(bd.Status.Conditions[1].Reason).To(Equal("InstallationSucceeded"))
@@ -127,8 +121,7 @@ var _ = Describe("Operator Install", func() {
127121
}
128122

129123
// Delete the catalog first
130-
err := c.Delete(ctx, operatorCatalog)
131-
Expect(err).ToNot(HaveOccurred())
124+
Expect(c.Delete(ctx, operatorCatalog)).To(Succeed())
132125

133126
Eventually(func(g Gomega) {
134127
// target package should not be present on cluster
@@ -137,13 +130,11 @@ var _ = Describe("Operator Install", func() {
137130
}).Should(Succeed())
138131

139132
By("creating the Operator resource")
140-
err = c.Create(ctx, operator)
141-
Expect(err).ToNot(HaveOccurred())
133+
Expect(c.Create(ctx, operator)).To(Succeed())
142134

143135
By("failing to find Operator during resolution")
144136
Eventually(func(g Gomega) {
145-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
146-
g.Expect(err).ToNot(HaveOccurred())
137+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
147138
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
148139
g.Expect(cond).ToNot(BeNil())
149140
g.Expect(cond.Status).To(Equal(metav1.ConditionFalse))
@@ -152,11 +143,11 @@ var _ = Describe("Operator Install", func() {
152143
}).Should(Succeed())
153144

154145
By("creating an Operator catalog with the desired package")
146+
var err error
155147
operatorCatalog, err = createTestCatalog(ctx, testCatalogName, testCatalogRef)
156148
Expect(err).ToNot(HaveOccurred())
157149
Eventually(func(g Gomega) {
158-
err = c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, operatorCatalog)
159-
g.Expect(err).ToNot(HaveOccurred())
150+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, operatorCatalog)).To(Succeed())
160151
cond := apimeta.FindStatusCondition(operatorCatalog.Status.Conditions, catalogd.TypeUnpacked)
161152
g.Expect(cond).ToNot(BeNil())
162153
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
@@ -165,8 +156,7 @@ var _ = Describe("Operator Install", func() {
165156

166157
By("eventually resolving the package successfully")
167158
Eventually(func(g Gomega) {
168-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)
169-
g.Expect(err).ToNot(HaveOccurred())
159+
g.Expect(c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)).To(Succeed())
170160
cond := apimeta.FindStatusCondition(operator.Status.Conditions, operatorv1alpha1.TypeResolved)
171161
g.Expect(cond).ToNot(BeNil())
172162
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
@@ -175,9 +165,9 @@ var _ = Describe("Operator Install", func() {
175165
})
176166

177167
AfterEach(func() {
178-
err := c.Delete(ctx, operator)
168+
Expect(c.Delete(ctx, operator)).To(Succeed())
179169
Eventually(func(g Gomega) {
180-
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, &operatorv1alpha1.Operator{})
170+
err := c.Get(ctx, types.NamespacedName{Name: operator.Name}, &operatorv1alpha1.Operator{})
181171
g.Expect(errors.IsNotFound(err)).To(BeTrue())
182172
}).Should(Succeed())
183173
})

0 commit comments

Comments
 (0)