Skip to content

Commit fde867d

Browse files
committed
Added testcase and fixed warning from lighttpd
1 parent 297fc42 commit fde867d

File tree

4 files changed

+42
-11
lines changed

4 files changed

+42
-11
lines changed

.github/workflows/regression-test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,27 @@ jobs:
151151
docker stop mapserver-rdnap-wfs
152152
153153
exit $exit_code
154+
- name: Regression test => Different CRS (RDNAPTRANS -> EPSG:4258)
155+
run: |
156+
# start mapserver
157+
docker run --rm -d -p 8181:80 --name mapserver-crs -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:local-nl
158+
159+
# execute request
160+
mkdir -p `pwd`/testdata/crs/actual
161+
curl "http://localhost:8181/mapserver?service=WFS&request=GetFeature&count=1&version=2.0.0&outputFormat=application/json&typeName=nationaleparken&srsName=EPSG:4258" -sL > `pwd`/testdata/crs/actual/output.json
162+
163+
# assert results are as expected
164+
exit_code=0
165+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1;
166+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1;
167+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1;
168+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1;
169+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1;
170+
171+
# cleanup
172+
rm -rf `pwd`/testdata/crs/actual
173+
174+
# stop mapserver
175+
docker stop mapserver-crs
176+
177+
exit $exit_code

config/lighttpd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
server.modules += ( "mod_setenv" )
2+
server.modules += ( "mod_indexfile" )
23
server.modules += ( "mod_fastcgi" )
34
server.modules += ( "mod_rewrite" )
45
server.modules += ( "mod_magnet" )
5-
server.modules += ( "mod_indexfile" )
66

77
index-file.names = ( "index.html" )
88
server.document-root = "/var/www/"

testdata/crs/README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,51 @@ This tests projecting WFS features in different coordinate systems, in particula
77
- EPSG:4326
88
- CRS:84
99

10-
TODO automate this test in the build
10+
This dataset has only 1 feature to have a reduced size in the Git repository.
1111

1212
## Run mapserver
1313

1414
### existing 7.6.4-patch5-2-buster-lighttpd
1515

16-
serving etrs89 source
17-
1816
```docker
1917
docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:7.6.4-patch5-2-buster-lighttpd
2018
2119
```
2220

21+
The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS`
22+
2323
### local built 8
2424

2525
Warning: This docker build compiles dependencies and will take a long time when running for the first time
2626
```docker
2727
docker build --target NL -t pdok/mapserver:8-local-NL .
2828
```
2929

30-
serving natpark source
30+
Serving Nationale Parken source
3131

3232
```docker
3333
docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:8-local-NL
3434
```
3535

36+
The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS`
37+
3638
## Verify the output
3739

3840

3941
```shell
42+
exit_code=0
43+
mkdir -p `pwd`/testdata/crs/actual/;
4044
IMAGE=pdok/mapserver:8-local-NL && \
41-
SOURCE_NAME=rd && \
45+
SOURCE_NAME=natpark && \
4246
OUT_NAME=etrs89 && \
4347
OUT_EPSG=4258 && \
44-
docker run --rm -p 80:80 -v `pwd`/ETRS89andRDNAP:/srv/data \
45-
-e MAPSERVER_CONFIG_FILE=/srv/data/${SOURCE_NAME}.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/${SOURCE_NAME}.map --entrypoint=mapserv \
48+
docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map --entrypoint=mapserv \
4649
"${IMAGE}" \
47-
-nh "QUERY_STRING=service=WFS&version=2.0.0&request=GetFeature&typeName=${SOURCE_NAME}&outputFormat=geojson&srsName=EPSG:${OUT_EPSG}" | \
48-
jq --arg crs "${OUT_NAME}" '.features | .[] | { id, x_dev: (.geometry.coordinates[0] - (.properties[$crs+"_x"]|tonumber)), y_dev: (.geometry.coordinates[1] - (.properties[$crs+"_y"]|tonumber)) } | {error: ((.x_dev|abs) > 0.001 or (.y_dev|abs) > 0.001 )} + .' | \
49-
jq -s 'group_by (.error)[] | {error: .[0].error, count: length}'
50+
-nh "QUERY_STRING=service=WFS&request=GetFeature&count=1&version=2.0.0&outputFormat=application/json&typeName=nationaleparken&srsName=EPSG:${OUT_EPSG}" > `pwd`/testdata/crs/actual/output.json;
51+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1;
52+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1;
53+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1;
54+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1;
55+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1;
56+
echo $exit_code
5057
```

testdata/crs/natpark.gpkg

96 KB
Binary file not shown.

0 commit comments

Comments
 (0)