Skip to content

Commit 05a62f5

Browse files
committed
PDOK-17792 Unit tests uitwerken voor WMS Kind in mapserver-operator conform ansible-operator
1 parent 8670c9e commit 05a62f5

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

internal/controller/wms_controller_test.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ var _ = Describe("WMS Controller", func() {
167167
return nil
168168
}, "10s", "1s").Should(Not(HaveOccurred()))
169169
})
170+
170171
It("Should successfully reconcile after a change in an owned resource", func() {
171172
controllerReconciler := getWMSReconciler()
172173

@@ -204,6 +205,7 @@ var _ = Describe("WMS Controller", func() {
204205
Expect(*deployment.Spec.RevisionHistoryLimit).To(BeEquivalentTo(originalRevisionHistoryLimit))
205206
}, "10s", "1s").Should(BeTrue())
206207
})
208+
207209
It("Should create correct deployment manifest.", func() {
208210
controllerReconciler := getWMSReconciler()
209211
reconcilerImages := getReconcilerImages(controllerReconciler)
@@ -342,7 +344,8 @@ var _ = Describe("WMS Controller", func() {
342344
By("Cleanup the specific resource instance WMS")
343345
Expect(k8sClient.Delete(ctx, wmsResource)).To(Succeed())
344346

345-
sampleWms, err := getUniqueWMSSample(9999)
347+
sampleWms, err := getUniqueWMSSample(counter)
348+
counter++
346349
typeNamespacedNameWms.Name = sampleWms.Name
347350
Expect(err).NotTo(HaveOccurred())
348351
sampleWms.Spec.Options.PrefetchData = smoothoperatorutils.Pointer(false)
@@ -358,6 +361,33 @@ var _ = Describe("WMS Controller", func() {
358361
Expect(err).To(HaveOccurred())
359362
})
360363

364+
It("Should not mount a ogc web service proxy configmap if options.DisableWebserviceProxy is true.", func() {
365+
wmsResource := &pdoknlv3.WMS{}
366+
wmsResource.Namespace = namespace
367+
wmsResource.Name = typeNamespacedNameWms.Name
368+
err := k8sClient.Get(ctx, typeNamespacedNameWms, wmsResource)
369+
Expect(client.IgnoreNotFound(err)).NotTo(HaveOccurred())
370+
371+
By("Cleanup the specific resource instance WMS")
372+
Expect(k8sClient.Delete(ctx, wmsResource)).To(Succeed())
373+
374+
sampleWms, err := getUniqueWMSSample(counter)
375+
counter++
376+
typeNamespacedNameWms.Name = sampleWms.Name
377+
Expect(err).NotTo(HaveOccurred())
378+
sampleWms.Spec.Options.DisableWebserviceProxy = smoothoperatorutils.Pointer(true)
379+
Expect(k8sClient.Create(ctx, sampleWms.DeepCopy())).To(Succeed())
380+
Expect(k8sClient.Get(ctx, typeNamespacedNameWms, wms)).To(Succeed())
381+
382+
controllerReconciler := getWMSReconciler()
383+
384+
By("Reconciling the WMS and checking the configMap")
385+
reconcileWMS(controllerReconciler, wms, typeNamespacedNameWms)
386+
387+
_, err = getHashedConfigMapNameFromClient(ctx, wms, mapserver.ConfigMapOgcWebserviceProxyVolumeName)
388+
Expect(err).To(HaveOccurred())
389+
})
390+
361391
It("Should create correct configMap manifest.", func() {
362392
controllerReconciler := getWMSReconciler()
363393

0 commit comments

Comments
 (0)