@@ -233,31 +233,46 @@ var _ = Describe("WMS Controller", func() {
233233 /**
234234 Container tests
235235 */
236- container := deployment .Spec .Template .Spec .Containers [0 ]
237- Expect (container .Name ).Should (Equal ("mapserver" ))
238- Expect (container .Ports [0 ].ContainerPort ).Should (Equal (int32 (80 )))
239- Expect (container .Image ).Should (Equal (reconcilerImages .MapserverImage ))
240- Expect (container .ImagePullPolicy ).Should (Equal (v1 .PullIfNotPresent ))
241- Expect (container .Resources .Limits .Memory ().String ()).Should (Equal ("800M" ))
242- Expect (container .Resources .Requests .Cpu ().String ()).Should (Equal ("100m" ))
243- Expect (len (container .LivenessProbe .Exec .Command )).Should (Equal (3 ))
244- Expect (container .LivenessProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=wms&request=GetCapabilities' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: text/xml'" ))
245- Expect (container .LivenessProbe .FailureThreshold ).Should (Equal (int32 (3 )))
246- Expect (container .LivenessProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
247- Expect (container .LivenessProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
248- Expect (container .LivenessProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
249- Expect (len (container .ReadinessProbe .Exec .Command )).Should (Equal (3 ))
250- Expect (container .ReadinessProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=190061.4619730016857,462435.5987861062749,202917.7508707302331,473761.6884966178914&CRS=EPSG:28992&WIDTH=100&HEIGHT=100&LAYERS=gpkg-layer-name&STYLES=&FORMAT=image/png' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: image/png'" ))
251- Expect (container .ReadinessProbe .FailureThreshold ).Should (Equal (int32 (3 )))
252- Expect (container .ReadinessProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
253- Expect (container .ReadinessProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
254- Expect (container .ReadinessProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
255- Expect (len (container .StartupProbe .Exec .Command )).Should (Equal (3 ))
256- Expect (container .StartupProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=190061.4619730016857,462435.5987861062749,202917.7508707302331,473761.6884966178914&CRS=EPSG:28992&WIDTH=100&HEIGHT=100&LAYERS=top-layer-name,group-layer-name,gpkg-layer-name,tif-layer-name&STYLES=&FORMAT=image/png' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: image/png'" ))
257- Expect (container .StartupProbe .FailureThreshold ).Should (Equal (int32 (3 )))
258- Expect (container .StartupProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
259- Expect (container .StartupProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
260- Expect (container .StartupProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
236+
237+ containerMapserver := deployment .Spec .Template .Spec .Containers [0 ]
238+ Expect (containerMapserver .Name ).Should (Equal ("mapserver" ))
239+ Expect (containerMapserver .Ports [0 ].ContainerPort ).Should (Equal (int32 (80 )))
240+ Expect (containerMapserver .Image ).Should (Equal (reconcilerImages .MapserverImage ))
241+ Expect (containerMapserver .ImagePullPolicy ).Should (Equal (v1 .PullIfNotPresent ))
242+ Expect (containerMapserver .Resources .Limits .Memory ().String ()).Should (Equal ("800M" ))
243+ Expect (containerMapserver .Resources .Requests .Cpu ().String ()).Should (Equal ("100m" ))
244+ Expect (len (containerMapserver .LivenessProbe .Exec .Command )).Should (Equal (3 ))
245+ Expect (containerMapserver .LivenessProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=wms&request=GetCapabilities' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: text/xml'" ))
246+ Expect (containerMapserver .LivenessProbe .FailureThreshold ).Should (Equal (int32 (3 )))
247+ Expect (containerMapserver .LivenessProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
248+ Expect (containerMapserver .LivenessProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
249+ Expect (containerMapserver .LivenessProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
250+ Expect (len (containerMapserver .ReadinessProbe .Exec .Command )).Should (Equal (3 ))
251+ Expect (containerMapserver .ReadinessProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=190061.4619730016857,462435.5987861062749,202917.7508707302331,473761.6884966178914&CRS=EPSG:28992&WIDTH=100&HEIGHT=100&LAYERS=gpkg-layer-name&STYLES=&FORMAT=image/png' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: image/png'" ))
252+ Expect (containerMapserver .ReadinessProbe .FailureThreshold ).Should (Equal (int32 (3 )))
253+ Expect (containerMapserver .ReadinessProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
254+ Expect (containerMapserver .ReadinessProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
255+ Expect (containerMapserver .ReadinessProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
256+ Expect (len (containerMapserver .StartupProbe .Exec .Command )).Should (Equal (3 ))
257+ Expect (containerMapserver .StartupProbe .Exec .Command [2 ]).Should (Equal ("wget -SO- -T 10 -t 2 'http://127.0.0.1:80/mapserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=190061.4619730016857,462435.5987861062749,202917.7508707302331,473761.6884966178914&CRS=EPSG:28992&WIDTH=100&HEIGHT=100&LAYERS=top-layer-name,group-layer-name,gpkg-layer-name,tif-layer-name&STYLES=&FORMAT=image/png' 2>&1 | egrep -aiA10 'HTTP/1.1 200' | egrep -i 'Content-Type: image/png'" ))
258+ Expect (containerMapserver .StartupProbe .FailureThreshold ).Should (Equal (int32 (3 )))
259+ Expect (containerMapserver .StartupProbe .InitialDelaySeconds ).Should (Equal (int32 (20 )))
260+ Expect (containerMapserver .StartupProbe .PeriodSeconds ).Should (Equal (int32 (10 )))
261+ Expect (containerMapserver .StartupProbe .TimeoutSeconds ).Should (Equal (int32 (10 )))
262+
263+ containerOgcWebserviceProxy := deployment .Spec .Template .Spec .Containers [1 ]
264+ Expect (containerOgcWebserviceProxy .Name ).Should (Equal ("ogc-webservice-proxy" ))
265+ ogcWebserviceProxyCommands := []string {"/ogc-webservice-proxy" , "-h=http://127.0.0.1/" , "-t=wms" , "-s=/input/service-config.yaml" , "-v" , "-r" , "-d=15" }
266+ Expect (containerOgcWebserviceProxy .Command ).Should (Equal (ogcWebserviceProxyCommands ))
267+ Expect (containerOgcWebserviceProxy .Image ).Should (Equal (reconcilerImages .OgcWebserviceProxyImage ))
268+ Expect (containerOgcWebserviceProxy .ImagePullPolicy ).Should (Equal (v1 .PullIfNotPresent ))
269+ Expect (containerOgcWebserviceProxy .Ports [0 ].ContainerPort ).Should (Equal (int32 (9111 )))
270+ Expect (containerOgcWebserviceProxy .Resources .Limits .Memory ().String ()).Should (Equal ("200M" ))
271+ Expect (containerOgcWebserviceProxy .Resources .Requests .Cpu ().String ()).Should (Equal ("50m" ))
272+ volumeMountsContainerOgcWebserviceProxy := []v1.VolumeMount {
273+ {Name : mapserver .ConfigMapOgcWebserviceProxyVolumeName , MountPath : "/input" , ReadOnly : true },
274+ }
275+ Expect (containerOgcWebserviceProxy .VolumeMounts ).Should (Equal (volumeMountsContainerOgcWebserviceProxy ))
261276
262277 /**
263278 Init container tests
@@ -430,7 +445,7 @@ var _ = Describe("WMS Controller", func() {
430445 Expect (err ).To (HaveOccurred ())
431446 })
432447
433- It ("Should not mount a ogc web service proxy configmap if options.REWRITEGROUPTODATALAYERS is FALSE." , func () {
448+ It ("Should not mount a legend-fixer initcontainer if options.REWRITEGROUPTODATALAYERS is FALSE." , func () {
434449 wmsResource := & pdoknlv3.WMS {}
435450 wmsResource .Namespace = namespace
436451 wmsResource .Name = typeNamespacedNameWms .Name
@@ -464,6 +479,37 @@ var _ = Describe("WMS Controller", func() {
464479 Expect (legendFixer .Name ).To (BeEquivalentTo ("" ))
465480 })
466481
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:
512+
467513 It ("Should create correct configMap manifest." , func () {
468514 controllerReconciler := getWMSReconciler ()
469515
0 commit comments