Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geosphere-mapserver
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cspp_geo
geosphere
geosphere-mapserver
Commits
fd7681bc
Verified
Commit
fd7681bc
authored
2 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Refactor CI test script
parent
80a1cfc2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ci/test_mapserver_image.sh
+54
-33
54 additions, 33 deletions
ci/test_mapserver_image.sh
with
54 additions
and
33 deletions
ci/test_mapserver_image.sh
+
54
−
33
View file @
fd7681bc
...
...
@@ -15,37 +15,58 @@ fi
image_url
=
$1
image_tag
=
$2
exit_status
=
0
# Test Basic Mapfile Render
debug
"Starting test docker container (
${
image_url
}
:
${
image_tag
}
)..."
docker run
--rm
-d
--name
test
-p
8888:80
${
image_url
}
:
${
image_tag
}
||
exit_status
=
1
# just wait a bit to let the server start
sleep
2
debug
"Container started. Starting curl basic request..."
curl
--max-time
5
"http://localhost:8888/"
>
/dev/null
||
exit_status
=
1
debug
"Curl complete. Killing docker container..."
docker
kill test
debug
"Done killing docker container."
# Test with postgres settings provided
debug
"Starting test docker container (
${
image_url
}
:
${
image_tag
}
)..."
docker run
--rm
-d
--name
test
-e
POSTGRES_HOST
=
localhost
-e
POSTGRES_PASSWORD_FILE
=
"/secrets/fake_file"
-p
8888:80
${
image_url
}
:
${
image_tag
}
||
exit_status
=
1
# just wait a bit to let the server start
sleep
2
debug
"Container started. Starting curl basic request..."
curl
--fail
-sS
--max-time
5
"http://localhost:8888/"
>
/dev/null
||
exit_status
=
1
debug
"Creating fake shapefile directory for C01"
docker
exec test mkdir
-p
/data/tiles/g16/abi/radf/C01
debug
"Creating fake shapefile file for C01"
docker
exec test
python3
-c
"import fiona; fiona.open('/data/tiles/g16/abi/radf/C01/C01.shp', 'w', driver='ESRI Shapefile', schema={'geometry': 'Polygon', 'properties': {'location': 'str', 'time': 'str:19'}})"
debug
"Starting curl basic mapfile request..."
# NOTE: The time doesn't actually exist and no image data is available. A blank image should be returned
curl
--fail
-sS
--max-time
5
"http://localhost:8888/wms/g16/abi/radf/l1b?VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&STYLES=&BBOX=-1330667.479176%2c-2773559.926648%2c2773559.926648%2c1330667.479176&WIDTH=256&HEIGHT=256&FORMAT=rgba&SRS=EPSG%3a930916&LAYERS=C01&TIME=2022-04-20T16:00:21Z"
>
/dev/null
||
exit_status
=
1
debug
"Curl complete. Killing docker container..."
docker
kill test
debug
"Done killing docker container."
exit
$exit_status
\ No newline at end of file
add_shapefile_content
()
{
debug
"Creating fake shapefile directory for C01"
docker
exec test mkdir
-p
/data/tiles/g16/abi/radf/C01
debug
"Creating fake shapefile file for C01"
# TODO: Turn this into a function call it for the earlier test and add a wms_times request
docker
exec test
python3
-c
"import fiona; fiona.open('/data/tiles/g16/abi/radf/C01/C01.shp', 'w', driver='ESRI Shapefile', schema={'geometry': 'Polygon', 'properties': {'location': 'str', 'time': 'str:19'}})"
}
kill_test_container
()
{
debug
"Curl complete. Killing docker container..."
docker
kill test
>
/dev/null
debug
"Done killing docker container."
}
run_basic_shapefile_tests
()
{
sf_exit_status
=
0
debug
"Starting test docker container (
${
image_url
}
:
${
image_tag
}
) for shapefile tests..."
docker run
--rm
-d
--name
test
-p
8888:80
${
image_url
}
:
${
image_tag
}
||
sf_exit_status
=
1
# just wait a bit to let the server start
sleep
2
debug
"Container started. Starting curl basic request..."
curl
--fail
-sS
--max-time
5
"http://localhost:8888/"
>
/dev/null
||
sf_exit_status
=
1
kill_test_container
return
$sf_exit_status
}
run_basic_postgres_tests
()
{
pg_exit_status
=
0
# Test with postgres settings provided
debug
"Starting test docker container (
${
image_url
}
:
${
image_tag
}
) for postgres tests..."
docker run
--rm
-d
--name
test
-e
POSTGRES_HOST
=
localhost
-e
POSTGRES_PASSWORD_FILE
=
"/secrets/fake_file"
-p
8888:80
${
image_url
}
:
${
image_tag
}
||
pg_exit_status
=
1
# just wait a bit to let the server start
sleep
2
debug
"Container started. Starting curl basic request..."
curl
--fail
-sS
--max-time
5
"http://localhost:8888/"
>
/dev/null
||
pg_exit_status
=
1
add_shapefile_content
debug
"Starting curl basic mapfile request..."
# NOTE: The time doesn't actually exist and no image data is available. A blank image should be returned
curl
--fail
-sS
--max-time
5
"http://localhost:8888/wms/g16/abi/radf/l1b?VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&STYLES=&BBOX=-1330667.479176%2c-2773559.926648%2c2773559.926648%2c1330667.479176&WIDTH=256&HEIGHT=256&FORMAT=rgba&SRS=EPSG%3a930916&LAYERS=C01&TIME=2022-04-20T16:00:21Z"
>
/dev/null
||
pg_exit_status
=
1
kill_test_container
return
$pg_exit_status
}
exit_status
=
0
run_basic_shapefile_tests
||
exit_status
=
1
run_basic_postgres_tests
||
exit_status
=
1
if
[[
$exit_status
-eq
0
]]
;
then
debug
"SUCCESSFUL"
else
debug
"FAIL"
fi
exit
$exit_status
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment