-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.bash
executable file
·73 lines (62 loc) · 1.53 KB
/
test.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -o errexit -o nounset
usage() {
cat >&2 << 'EOF'
Synopsis: ./test.bash "$qgis_version" "$ldi_linz_key" "$ldi_mfe_key" "$ldi_nzdf_key" "$ldi_basemaps_key"
Example: ./test.bash latest a1 b2 c3 d4
The QGIS version has to be one of the official QGIS Docker image tags <https://hub.docker.com/r/qgis/qgis/tags>.
EOF
}
arguments="$(getopt --options '' --longoptions help --name "$0" -- "$@")"
eval set -- "$arguments"
unset arguments
while true
do
case "$1" in
--help)
usage
exit
;;
--)
shift
break
;;
*)
printf 'Not implemented: %q\n' "$1" >&2
exit 1
;;
esac
done
if [[ $# -ne 5 ]]
then
usage
exit 2
fi
qgis_version_tag="$1"
export LDI_LINZ_KEY="$2"
export LDI_MFE_KEY="$3"
export LDI_NZDF_KEY="$4"
export LDI_BASEMAPS_KEY="$5"
image='qgis/qgis'
plugin_name='linz-data-importer'
image_name="${image}:${qgis_version_tag}"
container_name="${image/\//-}-${qgis_version_tag}"
cleanup() {
docker stop "$container_name"
}
trap cleanup EXIT
docker run \
--detach \
--name="$container_name" \
--volume="${PWD}:/tests_directory" \
--env=LDI_LINZ_KEY \
--env=LDI_MFE_KEY \
--env=LDI_NZDF_KEY \
--env=LDI_BASEMAPS_KEY \
--env=DISPLAY=:99 \
--pull=always \
--rm \
"$image_name"
sleep 10
docker exec "$container_name" qgis_setup.sh "$plugin_name"
docker exec -t "$container_name" qgis_testrunner.sh "${plugin_name}.tests.run_tests.run_test_modules"