Skip to content

Add regression test action; add test data #4

Add regression test action; add test data

Add regression test action; add test data #4

Workflow file for this run

---
name: regression-test
on:
pull_request:
jobs:
test-regression:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# build local test image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build test image
uses: docker/build-push-action@v5
with:
push: false
tags: pdok/mapserver:local
- name: Regression test => rectObj wrong projection
run: |
# start WMS and WFS mapservers
docker run -e MAPSERVER_CONFIG_FILE=/srv/data/rectobj.conf -e MS_MAPFILE=/srv/data/rectobj.map -e SERVICE_TYPE=WMS --rm -d \
-p 8181:80 --name mapserver-rectobj-wms -v `pwd`/testdata/rectobj:/srv/data pdok/mapserver:local
docker run -e MAPSERVER_CONFIG_FILE=/srv/data/rectobj.conf -e MS_MAPFILE=/srv/data/rectobj.map -e SERVICE_TYPE=WFS --rm -d \
-p 8182:80 --name mapserver-rectobj-wfs -v `pwd`/testdata/rectobj:/srv/data pdok/mapserver:local
# execute requests
mkdir -p `pwd`/testdata/rectobj/actual
curl "http://localhost:8181/mapserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=545287.2873572960962,6867556.049125162885,545689.3385149866808,6868025.580225903541&CRS=EPSG:3857&WIDTH=995&HEIGHT=1162&LAYERS=pand&STYLES=&FORMAT=image/png&TRANSPARENT=TRUE" -sLo `pwd`/testdata/rectobj/actual/rectobj.png
curl "http://localhost:8182/mapserver?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=bag:pand&STARTINDEX=0&COUNT=1000&SRSNAME=urn:ogc:def:crs:EPSG::3857&BBOX=545287.2873572960962,6867556.049125162885,545689.3385149866808,6868025.580225903541,urn:ogc:def:crs:EPSG::3857" -sLo `pwd`/testdata/rectobj/actual/rectobj.xml
# assert results are as expected
exit_code=0
# diff WMS png files, if binary diff exists, check for 'perceptual diff'
wms_diff=$(diff -q `pwd`/testdata/rectobj/expected/wms.png `pwd`/testdata/rectobj/actual/rectobj.png)
if [ -n "$wms_diff" ]
then
echo "binary diff between images, checking for perceptual diff"
wms_pdiff=$(`pwd`/testdata/perceptualdiff `pwd`/testdata/rectobj/expected/wms.png `pwd`/testdata/rectobj/actual/rectobj.png)
if [ -n "$wms_pdiff" ]
then
echo "$wms_pdiff"
exit_code=1
fi
fi
# diff WFS xml files, ignore timestamp but match numberMatched and numberReturned
wfs_diff=$(diff -q `pwd`/testdata/rectobj/expected/wfs.xml `pwd`/testdata/rectobj/actual/rectobj.xml -I 'timeStamp="[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}"\snumberMatched="5"\snumberReturned="5"')
if [ -n "$wfs_diff" ]
then
echo "$wfs_diff"
exit_code=1
fi
# cleanup
rm -rf `pwd`/testdata/rectobj/actual
# stop mapservers
docker stop mapserver-rectobj-wms
docker stop mapserver-rectobj-wfs
exit $exit_code