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
02688ead
Verified
Commit
02688ead
authored
2 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add fake postgres record to unit test
parent
b64aaa5d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#36969
failed with stages
in 5 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ci/test_mapserver_image.sh
+30
-15
30 additions, 15 deletions
ci/test_mapserver_image.sh
with
30 additions
and
15 deletions
ci/test_mapserver_image.sh
+
30
−
15
View file @
02688ead
...
...
@@ -75,7 +75,16 @@ s_file.write({
EOF
}
add_postgres_content
()
{
add_postgres_projections
()
{
# copied from tile gen
debug
"Creating PostGIS projections"
docker
exec
-i
${
PG_SERVER_NAME
}
psql
-U
${
POSTGRES_USER
}
<<
EOF
INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)
values (930916, 'EPSG', 4269, 'PROJCRS["GOES-16 ABI Fixed Grid",BASEGEOGCRS["GOES-16 ABI Fixed Grid",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep X)"],PARAMETER["Longitude of natural origin",-75,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35786023,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]', '+proj=geos +sweep=x +lon_0=-75 +h=35786023 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +type=crs') ON CONFLICT (srid) DO NOTHING
EOF
}
add_postgres_tables
()
{
debug
"Creating PostGIS table"
docker
exec
-i
${
PG_SERVER_NAME
}
psql
-U
${
POSTGRES_USER
}
<<
EOF
CREATE TABLE IF NOT EXISTS g16_abi_radf_l1b_c01 (
...
...
@@ -85,22 +94,27 @@ 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
()
{
# copied from tile gen
debug
"Creating PostGIS projections"
add_postgres_content
()
{
debug
"Creating values for fake DB row for C01"
insert_values
=
$(
docker
exec
-i
test
python3
<<
EOF
from shapely.geometry import box
from shapely import wkb
dt_str = "
${
C01_ISOTIME
}
"
location = "/data/tiles/g16/abi/radf/
${
C01_GTIFF_NAME
}
"
bbox = box(-50000, -50000, 50000, 50000)
bbox_wkb = wkb.dumps(bbox, hex=True, srid=930916)
values = (dt_str, location, bbox_wkb)
print(repr(values))
EOF
)
debug
"Inserting fake DB row for C01"
docker
exec
-i
${
PG_SERVER_NAME
}
psql
-U
${
POSTGRES_USER
}
<<
EOF
INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)
values (930916, 'EPSG', 4269, 'PROJCRS["GOES-16 ABI Fixed Grid",BASEGEOGCRS["GOES-16 ABI Fixed Grid",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep X)"],PARAMETER["Longitude of natural origin",-75,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35786023,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]', '+proj=geos +sweep=x +lon_0=-75 +h=35786023 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +type=crs') ON CONFLICT (srid) DO NOTHING
INSERT into g16_abi_radf_l1b_c01 (start_time, location, bbox_geometry)
VALUES
${
insert_values
}
ON CONFLICT (start_time) DO NOTHING
RETURNING (start_time)
EOF
}
...
...
@@ -199,10 +213,11 @@ run_basic_postgres_tests() {
start_pg_test_container
add_shapefile_content
add_postgres_projections
add_postgres_tables
add_postgres_content
curl_index
curl_layer_times
"[]"
curl_layer_times
"[
\"
${
C01_ISOTIME
}
\"
]"
curl_empty_tile
debug
"SUCCESS: Postgres test completed successfully"
teardown_test
...
...
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