Skip to content
Snippets Groups Projects
Verified Commit 6290a127 authored by David Hoese's avatar David Hoese
Browse files

Add image value checking to testing script

parent 02688ead
No related branches found
No related tags found
No related merge requests found
...@@ -190,9 +190,32 @@ curl_layer_times() { ...@@ -190,9 +190,32 @@ curl_layer_times() {
curl_empty_tile() { curl_empty_tile() {
debug "Starting curl basic mapfile request..." 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 # NOTE: The time doesn't actually exist and no image data is available. A blank image should be returned
curl --fail -sS "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 curl --fail -sS -o "empty_tile.png" "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
check_image_content "empty_tile.png" 0
} }
check_image_content() {
img_filename=$1
pixel_value=$2
docker exec -i test pip install pillow >/dev/null
incontainer_file="/tmp/$(basename $img_filename)"
docker cp $img_filename test:${incontainer_file}
docker exec -i test python3 <<EOF
import sys
import io
import os
import numpy as np
from PIL import Image
img = Image.open("${incontainer_file}")
img_arr = np.asarray(img)
assert img_arr.shape == (256, 256, 4)
assert (img_arr[:, :, :3] == ${pixel_value}).all()
EOF
}
run_basic_shapefile_tests() { run_basic_shapefile_tests() {
setup_test setup_test
debug "Starting shapefile tests..." debug "Starting shapefile tests..."
...@@ -215,6 +238,8 @@ run_basic_postgres_tests() { ...@@ -215,6 +238,8 @@ run_basic_postgres_tests() {
add_postgres_projections add_postgres_projections
add_postgres_tables add_postgres_tables
add_postgres_content add_postgres_content
# TODO: Verify empty tile is empty
# TODO: Add fake geotiff and tile check for inserted time and verify non-empty result
curl_index curl_index
curl_layer_times "[\"${C01_ISOTIME}\"]" curl_layer_times "[\"${C01_ISOTIME}\"]"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment