Skip to content

Commit 71ddbd0

Browse files
committed
fix tests
1 parent 6e0e593 commit 71ddbd0

29 files changed

+65
-31
lines changed

api/v2beta1/wms_conversion.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ func (v2Service WMSService) MapLayersToV3() pdoknlv3.Layer {
353353

354354
if ok {
355355
topLayer = &notGroupedLayers[0]
356+
var bbox *pdoknlv3.WMSBoundingBox
357+
if len(topLayer.BoundingBoxes) > 0 {
358+
bbox = &topLayer.BoundingBoxes[0]
359+
}
360+
topLayer.BoundingBoxes = getDefaultWMSLayerBoundingBoxes(bbox)
356361
}
357362
}
358363

api/v2beta1/wms_conversion_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
3939
want: pdoknlv3.Layer{
4040
Title: ptr.To(""),
4141
Abstract: ptr.To(""),
42-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
42+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
4343
Visible: true,
4444
Layers: []pdoknlv3.Layer{{
4545
Name: ptr.To("layer"),
@@ -58,7 +58,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
5858
want: pdoknlv3.Layer{
5959
Title: ptr.To(""),
6060
Abstract: ptr.To(""),
61-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
61+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
6262
Visible: true,
6363
Layers: []pdoknlv3.Layer{{
6464
Name: ptr.To("group-layer"),
@@ -87,7 +87,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
8787
want: pdoknlv3.Layer{
8888
Title: ptr.To(""),
8989
Abstract: ptr.To(""),
90-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
90+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
9191
Visible: true,
9292
Layers: []pdoknlv3.Layer{
9393
{
@@ -131,7 +131,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
131131
want: pdoknlv3.Layer{
132132
Title: ptr.To(""),
133133
Abstract: ptr.To(""),
134-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
134+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
135135
Visible: true,
136136
Layers: []pdoknlv3.Layer{
137137
{
@@ -166,7 +166,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
166166
}},
167167
want: pdoknlv3.Layer{
168168
Name: ptr.To("top-layer"),
169-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
169+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
170170
Visible: true,
171171
Styles: []pdoknlv3.Style{},
172172
Layers: []pdoknlv3.Layer{{
@@ -195,7 +195,7 @@ func TestWMSService_MapLayersToV3(t *testing.T) {
195195
}},
196196
want: pdoknlv3.Layer{
197197
Name: ptr.To("top-layer"),
198-
BoundingBoxes: []pdoknlv3.WMSBoundingBox{},
198+
BoundingBoxes: getDefaultWMSLayerBoundingBoxes(nil),
199199
Visible: true,
200200
Styles: []pdoknlv3.Style{},
201201
Layers: []pdoknlv3.Layer{

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,7 @@ spec:
19991999
- title
20002000
- abstract
20012001
- keywords
2002+
- boundingBoxes
20022003
- layers
20032004
type: object
20042005
x-kubernetes-validations:

internal/controller/mapfilegenerator/mapfile_generator_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"os"
66
"testing"
77

8+
"k8s.io/apimachinery/pkg/util/validation/field"
9+
810
"github.com/google/go-cmp/cmp"
911

1012
"github.com/pdok/mapserver-operator/api/v2beta1"
@@ -29,6 +31,9 @@ func TestGetConfigForWFS(t *testing.T) {
2931
inputWfs := pdoknlv3.WFS{}
3032
err = yaml.Unmarshal(input, &inputWfs)
3133
assert.NoError(t, err)
34+
warnings := []string{}
35+
allErrs := field.ErrorList{}
36+
pdoknlv3.ValidateWFS(&inputWfs, &warnings, &allErrs)
3237

3338
inputStruct, err := MapWFSToMapfileGeneratorInput(&inputWfs, ownerInfo)
3439
assert.NoError(t, err)

internal/controller/mapfilegenerator/test_data/input/wfs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ spec:
8181
- service-keyword-2
8282
- infoFeatureAccessService
8383
otherCrs:
84-
- EPSG:28992
8584
- EPSG:25831
8685
- EPSG:25832
8786
- EPSG:3034

internal/controller/test_data/wfs/complete/expected/configmap-capabilities-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ metadata:
107107
service-type: wfs
108108
service-version: v1_0
109109
theme: theme
110-
name: complete-wfs-capabilities-generator-cgh9g4d467
110+
name: complete-wfs-capabilities-generator-g57dmd6b78
111111
namespace: default
112112
ownerReferences:
113113
- apiVersion: pdok.nl/v3

internal/controller/test_data/wfs/complete/expected/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ spec:
261261
name: complete-wfs-init-scripts-fft29bbtdd
262262
name: init-scripts
263263
- configMap:
264-
name: complete-wfs-capabilities-generator-cgh9g4d467
264+
name: complete-wfs-capabilities-generator-g57dmd6b78
265265
defaultMode: 420
266266
name: capabilities-generator-config
267267
- configMap:

internal/controller/test_data/wfs/minimal/expected/configmap-capabilities-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
pdok.nl/inspire: 'false'
1212
service-type: wfs
1313
service-version: v1_0
14-
name: minimal-wfs-capabilities-generator-tk7t48fd89
14+
name: minimal-wfs-capabilities-generator-md7fhtmd4f
1515
namespace: default
1616
ownerReferences:
1717
- apiVersion: pdok.nl/v3

internal/controller/test_data/wfs/minimal/expected/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ spec:
244244
name: minimal-wfs-init-scripts-fft29bbtdd
245245
name: init-scripts
246246
- configMap:
247-
name: minimal-wfs-capabilities-generator-tk7t48fd89
247+
name: minimal-wfs-capabilities-generator-md7fhtmd4f
248248
defaultMode: 420
249249
name: capabilities-generator-config
250250
- configMap:

internal/controller/test_data/wfs/noprefetch/expected/configmap-capabilities-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
pdok.nl/inspire: 'false'
1212
service-type: wfs
1313
service-version: v1_0
14-
name: noprefetch-wfs-capabilities-generator-tk7t48fd89
14+
name: noprefetch-wfs-capabilities-generator-md7fhtmd4f
1515
namespace: default
1616
ownerReferences:
1717
- apiVersion: pdok.nl/v3

0 commit comments

Comments
 (0)