Skip to content

Commit 3f1172e

Browse files
committed
PDOK-17792 Unit tests uitwerken voor WMS Kind in mapserver-operator conform ansible-operator. options.VALIDATEREQUESTS
1 parent ce6d734 commit 3f1172e

File tree

1 file changed

+41
-30
lines changed

1 file changed

+41
-30
lines changed

internal/controller/wms_controller_test.go

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -479,36 +479,47 @@ var _ = Describe("WMS Controller", func() {
479479
Expect(legendFixer.Name).To(BeEquivalentTo(""))
480480
})
481481

482-
// TODO:
483-
484-
//It("Should not mount a legend-fixer initcontainer if options.AUTOMATICCASING is FALSE.", func() {
485-
// wmsResource := &pdoknlv3.WMS{}
486-
// wmsResource.Namespace = namespace
487-
// wmsResource.Name = typeNamespacedNameWms.Name
488-
// err := k8sClient.Get(ctx, typeNamespacedNameWms, wmsResource)
489-
// Expect(client.IgnoreNotFound(err)).NotTo(HaveOccurred())
490-
//
491-
// By("Cleanup the specific resource instance WMS")
492-
// Expect(k8sClient.Delete(ctx, wmsResource)).To(Succeed())
493-
//
494-
// sampleWms, err := getUniqueWMSSample(counter)
495-
// counter++
496-
// typeNamespacedNameWms.Name = sampleWms.Name
497-
// Expect(err).NotTo(HaveOccurred())
498-
// sampleWms.Spec.Options.AutomaticCasing = false
499-
//
500-
// Expect(k8sClient.Create(ctx, sampleWms.DeepCopy())).To(Succeed())
501-
// Expect(k8sClient.Get(ctx, typeNamespacedNameWms, wms)).To(Succeed())
502-
//
503-
// controllerReconciler := getWMSReconciler()
504-
//
505-
// By("Reconciling the WMS and checking the configMap")
506-
// reconcileWMS(controllerReconciler, wms, typeNamespacedNameWms)
507-
// deployment := &appsv1.Deployment{}
508-
// err = k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: getBareDeployment(wms, MapserverName).GetName()}, deployment)
509-
// Expect(err).NotTo(HaveOccurred())
510-
//})
511-
// TODO:
482+
It("ogcWebserviceProxyCommands will not contain command '-v' if options.VALIDATEREQUESTS is FALSE.", func() {
483+
wmsResource := &pdoknlv3.WMS{}
484+
wmsResource.Namespace = namespace
485+
wmsResource.Name = typeNamespacedNameWms.Name
486+
err := k8sClient.Get(ctx, typeNamespacedNameWms, wmsResource)
487+
Expect(client.IgnoreNotFound(err)).NotTo(HaveOccurred())
488+
489+
By("Cleanup the specific resource instance WMS")
490+
Expect(k8sClient.Delete(ctx, wmsResource)).To(Succeed())
491+
492+
sampleWms, err := getUniqueWMSSample(counter)
493+
counter++
494+
typeNamespacedNameWms.Name = sampleWms.Name
495+
Expect(err).NotTo(HaveOccurred())
496+
sampleWms.Spec.Options.ValidateRequests = smoothoperatorutils.Pointer(false)
497+
498+
Expect(k8sClient.Create(ctx, sampleWms.DeepCopy())).To(Succeed())
499+
Expect(k8sClient.Get(ctx, typeNamespacedNameWms, wms)).To(Succeed())
500+
501+
controllerReconciler := getWMSReconciler()
502+
503+
By("Reconciling the WMS and checking the configMap")
504+
reconcileWMS(controllerReconciler, wms, typeNamespacedNameWms)
505+
deployment := &appsv1.Deployment{}
506+
err = k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: getBareDeployment(wms, MapserverName).GetName()}, deployment)
507+
Expect(err).NotTo(HaveOccurred())
508+
509+
containerOgcWebserviceProxy := deployment.Spec.Template.Spec.Containers[1]
510+
Expect(containerOgcWebserviceProxy.Name).Should(Equal("ogc-webservice-proxy"))
511+
ogcWebserviceProxyCommands := []string{"/ogc-webservice-proxy", "-h=http://127.0.0.1/", "-t=wms", "-s=/input/service-config.yaml", "-r", "-d=15"}
512+
Expect(containerOgcWebserviceProxy.Command).Should(Equal(ogcWebserviceProxyCommands))
513+
Expect(containerOgcWebserviceProxy.ImagePullPolicy).Should(Equal(v1.PullIfNotPresent))
514+
Expect(containerOgcWebserviceProxy.Ports[0].ContainerPort).Should(Equal(int32(9111)))
515+
Expect(containerOgcWebserviceProxy.Resources.Limits.Memory().String()).Should(Equal("200M"))
516+
Expect(containerOgcWebserviceProxy.Resources.Requests.Cpu().String()).Should(Equal("50m"))
517+
volumeMountsContainerOgcWebserviceProxy := []v1.VolumeMount{
518+
{Name: mapserver.ConfigMapOgcWebserviceProxyVolumeName, MountPath: "/input", ReadOnly: true},
519+
}
520+
Expect(containerOgcWebserviceProxy.VolumeMounts).Should(Equal(volumeMountsContainerOgcWebserviceProxy))
521+
522+
})
512523

513524
It("Should create correct configMap manifest.", func() {
514525
controllerReconciler := getWMSReconciler()

0 commit comments

Comments
 (0)