EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 76c82386 authored by Mussab Abdalla's avatar Mussab Abdalla
Browse files

adding more assertation test

parent 413a6b8c
No related branches found
No related tags found
1 merge request!29Preprocessor test
......@@ -46,7 +46,7 @@ pip3 install -r requirements.txt
docker service ls
# perform the testing
bash ./preprocessor_test.sh
bash ./preprocessor_test.sh preprocessed_list.csv
bash ./registrar_test.sh product_list.csv
if [ $? -ne 0 ]
......
RS02_SAR_QF_SLC_20140518T050904_20140518T050909_TRS_33537_0000.tar
KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_019339_75CE.tar
import os
from dotenv import load_dotenv
from osgeo import gdal
# ST_AUTH_VERSION=3
# OS_AUTH_URL_SHORT=https://auth.cloud.ovh.net/
# OS_AUTH_URL=https://auth.cloud.ovh.net/v3/
# OS_USERNAME=xqNChf3Rz5vs
# OS_TENANT_NAME=7398560954290261
# OS_TENANT_ID=1b418c4359064774af5d55da3f4bcac0
# OS_REGION_NAME=SERCO-DIAS1
# load_dotenv(dotenv_path='../env/emg_obs.env')
# gdal.SetConfigOption('SWIFT_AUTH_V3_URL', os.environ['ST_AUTH_VERSION'])
# gdal.SetConfigOption('SWIFT_USER', os.environ['OS_AUTH_URL_SHORT'])
# gdal.SetConfigOption('SWIFT_KEY', os.environ['OS_AUTH_URL'])
# gdal.SetConfigOption('SWIFT_STORAGE_URL', os.environ['OS_USERNAME'])
# gdal.SetConfigOption('SWIFT_AUTH_TOKEN', os.environ[''])
image = gdal.Open('/vsiswift/preprocessor_results/KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_019339_75CE.tar/K3_20160101113014_19339_02281264_L1G.tif', gdal.GA_ReadOnly)
srcband = image.GetRasterBand(1)
print ("[ NO DATA VALUE ] = ", srcband.GetNoDataValue())
print ("[ MIN ] = ", srcband.GetMinimum())
print ("[ MAX ] = ", srcband.GetMaximum())
print ("[ SCALE ] = ", srcband.GetScale())
print ("[ UNIT TYPE ] = ", srcband.GetUnitType())
#!/bin/sh
#!/bin/bash
product_list_file=$1
OS_PASSWORD=$(docker exec -i $(docker ps -qf "name=emg-pvs_preprocessor") cat /run/secrets/OS_PASSWORD)
#preprocessing the images and save the results in the result bucket
docker exec -e OS_PASSWORD=$OS_PASSWORD -i $(docker ps -qf "name=emg-pvs_preprocessor") \
preprocessor preprocess --config-file testing/testing_preprocessor_config.yml KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_019339_75CE.tar
ST_AUTH_VERSION=3
OS_AUTH_URL_SHORT=https://auth.cloud.ovh.net/
OS_AUTH_URL=https://auth.cloud.ovh.net/v3/
......@@ -28,5 +25,16 @@ while read key value ; do
fi
done < preprocessor_test.txt
python3 preprocessor_test.py
while read product; do
echo $product
# preprocessing the images and save the results in the result bucket
docker exec -e OS_PASSWORD=$OS_PASSWORD -i $(docker ps -qf "name=emg-pvs_preprocessor") \
preprocessor preprocess --config-file testing/testing_preprocessor_config.yml $product < "$product_list_file"
done < "$product_list_file"
rm preprocessor_test.txt
\ No newline at end of file
import os
import csv
from osgeo import gdal
import pytest
import psycopg2
import paramiko
......@@ -49,7 +50,11 @@ def query_eo_object(connection, eo_id):
def test_db_name(connection, identifiers):
for row in identifiers:
identifier = row[0].split('/')[4]
query_eo_object(connection, identifier)
coverage_id = query_eo_object(connection, identifier)
db_name = connection.get_dsn_parameters()["dbname"]
assert coverage_id == identifier
assert db_name == os.environ['DB_USER']
def compare_links(sftp, product_xml, product):
......@@ -68,6 +73,7 @@ def compare_links(sftp, product_xml, product):
wcs_capabilities = 'emg.pass.copernicus.eu/ows?service=wcs&request=GetCapabilities&amp&cql=identifier='
expected_wms_link = '%s"%s"' % (wms_capabilities, product)
expected_wcs_link = '%s"%s"' % (wcs_capabilities, product)
assert expected_wms_link.replace('&amp&', '&') == wms_link
assert expected_wcs_link.replace('&amp&', '&') == wcs_link
......@@ -80,4 +86,12 @@ def test_reporting(sftp_connection, identifiers):
identifier = row[0].split('/')[4]
if identifier in item:
compare_links(sftp_connection, item, identifier)
\ No newline at end of file
compare_links(sftp_connection, item, identifier)
def test_preprocessor():
image = gdal.Open('/vsiswift/preprocessor_results/KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_019339_75CE.tar/K3_20160101113014_19339_02281264_L1G.tif', gdal.GA_ReadOnly)
srcband = image.GetRasterBand(1)
assert srcband.Checksum() != None
assert srcband.Checksum() > 0
\ No newline at end of file
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