@@ -40,13 +40,11 @@ var _ = Describe("Operator Install", func() {
40
40
})
41
41
It ("resolves the specified package with correct bundle path" , func () {
42
42
By ("creating the Operator resource" )
43
- err := c .Create (ctx , operator )
44
- Expect (err ).ToNot (HaveOccurred ())
43
+ Expect (c .Create (ctx , operator )).To (Succeed ())
45
44
46
45
By ("eventually reporting a successful resolution and bundle path" )
47
46
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 ())
50
48
g .Expect (len (operator .Status .Conditions )).To (Equal (2 ))
51
49
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
52
50
g .Expect (cond ).ToNot (BeNil ())
@@ -58,17 +56,16 @@ var _ = Describe("Operator Install", func() {
58
56
59
57
By ("eventually installing the package successfully" )
60
58
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 ())
63
60
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeInstalled )
64
61
g .Expect (cond ).ToNot (BeNil ())
65
62
g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
66
63
g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
67
64
g .Expect (cond .Message ).To (ContainSubstring ("installed from" ))
68
65
g .Expect (operator .Status .InstalledBundleResource ).ToNot (BeEmpty ())
66
+
69
67
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 ())
72
69
g .Expect (len (bd .Status .Conditions )).To (Equal (2 ))
73
70
g .Expect (bd .Status .Conditions [0 ].Reason ).To (Equal ("UnpackSuccessful" ))
74
71
g .Expect (bd .Status .Conditions [1 ].Reason ).To (Equal ("InstallationSucceeded" ))
@@ -84,13 +81,11 @@ var _ = Describe("Operator Install", func() {
84
81
})
85
82
It ("resolves the specified package with correct bundle path" , func () {
86
83
By ("creating the Operator resource" )
87
- err := c .Create (ctx , operator )
88
- Expect (err ).ToNot (HaveOccurred ())
84
+ Expect (c .Create (ctx , operator )).To (Succeed ())
89
85
90
86
By ("eventually reporting a successful resolution and bundle path" )
91
87
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 ())
94
89
g .Expect (len (operator .Status .Conditions )).To (Equal (2 ))
95
90
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
96
91
g .Expect (cond ).ToNot (BeNil ())
@@ -102,17 +97,16 @@ var _ = Describe("Operator Install", func() {
102
97
103
98
By ("eventually installing the package successfully" )
104
99
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 ())
107
101
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeInstalled )
108
102
g .Expect (cond ).ToNot (BeNil ())
109
103
g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
110
104
g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
111
105
g .Expect (cond .Message ).To (ContainSubstring ("installed from" ))
112
106
g .Expect (operator .Status .InstalledBundleResource ).ToNot (BeEmpty ())
107
+
113
108
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 ())
116
110
g .Expect (len (bd .Status .Conditions )).To (Equal (2 ))
117
111
g .Expect (bd .Status .Conditions [0 ].Reason ).To (Equal ("UnpackSuccessful" ))
118
112
g .Expect (bd .Status .Conditions [1 ].Reason ).To (Equal ("InstallationSucceeded" ))
@@ -127,8 +121,7 @@ var _ = Describe("Operator Install", func() {
127
121
}
128
122
129
123
// Delete the catalog first
130
- err := c .Delete (ctx , operatorCatalog )
131
- Expect (err ).ToNot (HaveOccurred ())
124
+ Expect (c .Delete (ctx , operatorCatalog )).To (Succeed ())
132
125
133
126
Eventually (func (g Gomega ) {
134
127
// target package should not be present on cluster
@@ -137,13 +130,11 @@ var _ = Describe("Operator Install", func() {
137
130
}).Should (Succeed ())
138
131
139
132
By ("creating the Operator resource" )
140
- err = c .Create (ctx , operator )
141
- Expect (err ).ToNot (HaveOccurred ())
133
+ Expect (c .Create (ctx , operator )).To (Succeed ())
142
134
143
135
By ("failing to find Operator during resolution" )
144
136
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 ())
147
138
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
148
139
g .Expect (cond ).ToNot (BeNil ())
149
140
g .Expect (cond .Status ).To (Equal (metav1 .ConditionFalse ))
@@ -152,11 +143,11 @@ var _ = Describe("Operator Install", func() {
152
143
}).Should (Succeed ())
153
144
154
145
By ("creating an Operator catalog with the desired package" )
146
+ var err error
155
147
operatorCatalog , err = createTestCatalog (ctx , testCatalogName , testCatalogRef )
156
148
Expect (err ).ToNot (HaveOccurred ())
157
149
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 ())
160
151
cond := apimeta .FindStatusCondition (operatorCatalog .Status .Conditions , catalogd .TypeUnpacked )
161
152
g .Expect (cond ).ToNot (BeNil ())
162
153
g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
@@ -165,8 +156,7 @@ var _ = Describe("Operator Install", func() {
165
156
166
157
By ("eventually resolving the package successfully" )
167
158
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 ())
170
160
cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
171
161
g .Expect (cond ).ToNot (BeNil ())
172
162
g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
@@ -175,9 +165,9 @@ var _ = Describe("Operator Install", func() {
175
165
})
176
166
177
167
AfterEach (func () {
178
- err := c .Delete (ctx , operator )
168
+ Expect ( c .Delete (ctx , operator )). To ( Succeed () )
179
169
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 {})
181
171
g .Expect (errors .IsNotFound (err )).To (BeTrue ())
182
172
}).Should (Succeed ())
183
173
})
0 commit comments