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
b64aaa5d
Verified
Commit
b64aaa5d
authored
2 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add record to shapefile test case for valid time to be returned
parent
3906c65d
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
+41
-20
41 additions, 20 deletions
ci/test_mapserver_image.sh
with
41 additions
and
20 deletions
ci/test_mapserver_image.sh
+
41
−
20
View file @
b64aaa5d
...
...
@@ -6,11 +6,11 @@ debug() {
error
()
{
echo
>
&2
"ERROR:
$@
"
exit
1
}
if
[[
$#
-ne
2
]]
;
then
error
"Usage: ./test_mapserver_image.sh <image_url> <image_tag>"
exit
1
fi
image_url
=
$1
...
...
@@ -25,6 +25,8 @@ POSTGRES_USER="postgres"
POSTGRES_PASSWORD
=
"1234"
NETWORK_NAME
=
`
basename
"
$0
"
`
NETWORK_NAME
=
${
NETWORK_NAME
/.sh/
}
C01_GTIFF_NAME
=
"GOES-16_ABI_RadF_C01_20220302_194032_GOES-West.tif"
C01_ISOTIME
=
"2022-03-02T19:40:32"
base_tmp_dir
=
"__TOBECREATED__"
setup_test
()
{
...
...
@@ -45,6 +47,7 @@ teardown_test() {
}
graceful_exit
()
{
debug
"FAIL"
debug
"Graceful exit"
teardown_test
}
...
...
@@ -53,8 +56,23 @@ 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'}})"
docker
exec
-i
test
python3
<<
EOF
import fiona
from shapely.geometry import mapping, box
s_file = fiona.open('/data/tiles/g16/abi/radf/C01/C01.shp',
'w',
driver='ESRI Shapefile',
schema={'geometry': 'Polygon', 'properties': {'location': 'str', 'time': 'str:19'}})
bbox = mapping(box(-50000, -50000, 50000, 50000))
s_file.write({
"geometry": bbox,
"properties": {
"location": "/data/tiles/g16/abi/radf/
${
C01_GTIFF_NAME
}
",
"time": "
${
C01_ISOTIME
}
",
},
})
EOF
}
add_postgres_content
()
{
...
...
@@ -67,6 +85,14 @@ CREATE TABLE IF NOT EXISTS g16_abi_radf_l1b_c01 (
bbox_geometry geometry(POLYGON, 930916)
)
EOF
# docker exec -i ${PG_SERVER_NAME} psql -U ${POSTGRES_USER} <<EOF
# CREATE TABLE IF NOT EXISTS g16_abi_radf_l1b_c01 (
# gid SERIAL PRIMARY KEY,
# start_time CHAR(19) NOT NULL UNIQUE,
# location VARCHAR(255) NOT NULL,
# bbox_geometry geometry(POLYGON, 930916)
# )
# EOF
}
add_postgres_projections
()
{
...
...
@@ -139,10 +165,12 @@ curl_layer_times() {
# []
# ["2020-12-25T15:29:25"]
if
[[
${
time_result
}
==
$
expected_result
]]
;
then
debug
"Time result (
${
time_result
}
) was not equal to the expected
${
expected_result
}
"
if
[[
"
${
time_result
}
"
!=
"
${
expected_result
}
"
]]
;
then
error
"Time result (
${
time_result
}
) was not equal to the expected
${
expected_result
}
"
return
1
fi
debug
"Time result (
${
time_result
}
) was equal to the expected
${
expected_result
}
"
return
$time_status
}
curl_empty_tile
()
{
...
...
@@ -152,20 +180,19 @@ curl_empty_tile() {
}
run_basic_shapefile_tests
()
{
set
-e
setup_test
debug
"Starting shapefile tests..."
start_test_container
add_shapefile_content
curl_index
curl_layer_times
"[]"
curl_layer_times
"[
\"
${
C01_ISOTIME
}
\"
]"
curl_empty_tile
teardown_test
debug
"SUCCESS: Shapefile test completed successfully"
set
+e
}
run_basic_postgres_tests
()
{
set
-e
setup_test
debug
"Starting postgres tests..."
start_postgres
...
...
@@ -179,22 +206,16 @@ run_basic_postgres_tests() {
curl_empty_tile
debug
"SUCCESS: Postgres test completed successfully"
teardown_test
set
+e
}
trap
graceful_exit EXIT
exit_status
=
0
run_basic_shapefile_tests
||
exit_status
=
1
set
-e
run_basic_shapefile_tests
echo
"#######"
run_basic_postgres_tests
||
exit_status
=
1
run_basic_postgres_tests
echo
"#######"
if
[[
$exit_status
-eq
0
]]
;
then
debug
"SUCCESS"
trap
- EXIT
# tests should have cleared this already, otherwise produces extra output
else
debug
"FAIL"
fi
exit
$exit_status
trap
- EXIT
# tests should have cleared this already, otherwise produces extra output
debug
"SUCCESS"
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