@@ -148,6 +148,34 @@ var _ = Describe("CleanupCronJobReconciler", func() {
148
148
Expect (reconciler .cron .Entries ()).To (BeEmpty ())
149
149
})
150
150
151
+ It ("Should not start cron if dwOperatorConfig.Config is nil" , func () {
152
+ dwoc := & controllerv1alpha1.DevWorkspaceOperatorConfig {
153
+ ObjectMeta : metav1.ObjectMeta {Name : nameNamespace .Name , Namespace : nameNamespace .Namespace },
154
+ Config : nil ,
155
+ }
156
+ Expect (fakeClient .Create (ctx , dwoc )).To (Succeed ())
157
+
158
+ result , err := reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : nameNamespace })
159
+ Expect (err ).ToNot (HaveOccurred ())
160
+ Expect (result ).To (Equal (ctrl.Result {}))
161
+ Expect (reconciler .cron .Entries ()).To (BeEmpty ())
162
+ })
163
+
164
+ It ("Should not start cron if dwOperatorConfig.Config.Workspace is nil" , func () {
165
+ dwoc := & controllerv1alpha1.DevWorkspaceOperatorConfig {
166
+ ObjectMeta : metav1.ObjectMeta {Name : nameNamespace .Name , Namespace : nameNamespace .Namespace },
167
+ Config : & controllerv1alpha1.OperatorConfiguration {
168
+ Workspace : nil ,
169
+ },
170
+ }
171
+ Expect (fakeClient .Create (ctx , dwoc )).To (Succeed ())
172
+
173
+ result , err := reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : nameNamespace })
174
+ Expect (err ).ToNot (HaveOccurred ())
175
+ Expect (result ).To (Equal (ctrl.Result {}))
176
+ Expect (reconciler .cron .Entries ()).To (BeEmpty ())
177
+ })
178
+
151
179
It ("Should not start cron if received event from different namespace" , func () {
152
180
dwoc := & controllerv1alpha1.DevWorkspaceOperatorConfig {
153
181
ObjectMeta : metav1.ObjectMeta {Name : nameNamespace .Name , Namespace : "other-namespace" },
@@ -185,7 +213,7 @@ var _ = Describe("CleanupCronJobReconciler", func() {
185
213
Expect (reconciler .cron .Entries ()).To (BeEmpty ())
186
214
})
187
215
188
- It ("Should do not start cron if pruning is disabled" , func () {
216
+ It ("Should not start cron if pruning is disabled" , func () {
189
217
enabled := false
190
218
dwoc := & controllerv1alpha1.DevWorkspaceOperatorConfig {
191
219
ObjectMeta : metav1.ObjectMeta {Name : nameNamespace .Name , Namespace : nameNamespace .Namespace },
@@ -205,7 +233,7 @@ var _ = Describe("CleanupCronJobReconciler", func() {
205
233
Expect (reconciler .cron .Entries ()).To (BeEmpty ())
206
234
})
207
235
208
- It ("Should do not start cron if schedule is missing" , func () {
236
+ It ("Should not start cron if schedule is missing" , func () {
209
237
enabled := true
210
238
dwoc := & controllerv1alpha1.DevWorkspaceOperatorConfig {
211
239
ObjectMeta : metav1.ObjectMeta {Name : nameNamespace .Name , Namespace : nameNamespace .Namespace },
0 commit comments