Skip to content

Commit

Permalink
Feature 460 travis use case tests (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored May 14, 2020
1 parent 6a92812 commit 7fb6fe9
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 116 deletions.
42 changes: 23 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,31 @@ matrix:
- docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/pytests/run_pytests.sh docker
# Dump the output directories from running METplus
- ls -alR ${OWNER_BUILD_DIR}/pytmp.docker
- name: "Integration Tests"
- name: "Use Case Tests - met_tool_wrapper"
python: 3.7
script:
# These commands should all be in a script in METplus repo.
# ie.
# - ${TRAVIS_BUILD_DIR}/ci/travis_job_integration_tests.sh
#
- mkdir -p ${OWNER_BUILD_DIR}/pytmp.docker;
- mkdir -p ${OWNER_BUILD_DIR}/test.metplus.data;
- cd ${OWNER_BUILD_DIR}/test.metplus.data;
curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-convection_allowing_models-3.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-medium_range-3.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-met_test-9.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-precipitation-3.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-s2s-3.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-space_weather-3.0.tgz; curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-tc_and_extra_tc-3.0.tgz
- tar xfzp sample_data-convection_allowing_models-3.0.tgz; tar xfzp sample_data-medium_range-3.0.tgz; tar xfzp sample_data-met_test-9.0.tgz; tar xfzp sample_data-precipitation-3.0.tgz; tar xfzp sample_data-s2s-3.0.tgz; tar xfzp sample_data-space_weather-3.0.tgz; tar xfzp sample_data-tc_and_extra_tc-3.0.tgz
- curl -L -O https://dtcenter.org/sites/default/files/community-code/metplus/utilities/GempakToCF.jar
- docker pull ${DOCKERHUB_TAG}
- docker images
- docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'echo $MY_CUSTOM_VAR;which master_metplus.py;ls -al /metplus;python -V'
- docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/use_cases/run_test_use_cases.sh docker
# Dump the output directories from running METplus
- ls -alR ${OWNER_BUILD_DIR}/pytmp.docker
# Dump and see how much space is left on Travis disk.
- df -h
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_met_tool_wrapper.sh
- name: "Use Case Tests - precipitation"
python: 3.7
script:
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_model_applications.sh precipitation
- name: "Use Case Tests - convection_allowing_models"
python: 3.7
script:
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_model_applications.sh convection_allowing_models
- name: "Use Case Tests - medium_range"
python: 3.7
script:
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_model_applications.sh medium_range
- name: "Use Case Tests - s2s, space_weather, tc_and_extra_tc"
python: 3.7
script:
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_model_applications.sh s2s space_weather tc_and_extra_tc
- name: "Use Case Tests - cryosphere"
python: 3.7
script:
# add travis_wait before command because a case takes longer than 10 minutes to return
- travis_wait 30 ${TRAVIS_BUILD_DIR}/ci/travis_jobs/test_use_cases_model_applications.sh cryosphere

# stage 1 fails due to doc8 has errors.
# This allows stage 1 to fail so the build can continue.
Expand Down
23 changes: 23 additions & 0 deletions ci/travis_jobs/test_use_cases_met_tool_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mkdir -p ${OWNER_BUILD_DIR}/test-use-case-output
mkdir -p ${OWNER_BUILD_DIR}/test.metplus.data

cd ${OWNER_BUILD_DIR}/test.metplus.data

curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-met_test-9.0.tgz
tar xfzp sample_data-met_test-9.0.tgz

curl -L -O https://dtcenter.org/sites/default/files/community-code/metplus/utilities/GempakToCF.jar

docker pull ${DOCKERHUB_TAG}
docker images
docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'echo $MY_CUSTOM_VAR;which master_metplus.py;ls -al /metplus;python -V'
docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/use_cases/run_test_use_cases.sh docker --met_tool_wrapper
returncode=$?

# Dump the output directories from running METplus
#ls -alR ${OWNER_BUILD_DIR}/test-use-case-output

# Dump and see how much space is left on Travis disk.
df -h

exit $returncode
40 changes: 40 additions & 0 deletions ci/travis_jobs/test_use_cases_model_applications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version=3.0

mkdir -p ${OWNER_BUILD_DIR}/test-use-case-output
mkdir -p ${OWNER_BUILD_DIR}/test.metplus.data

cd ${OWNER_BUILD_DIR}/test.metplus.data

# get sample data for all use case categories provided and add arguments to call to test script
test_args=''
for i in "$@"
do
if [ -z "$i" ]; then
continue
fi

curl -L -O https://github.com/NCAR/METplus/releases/download/v${version}/sample_data-${i}-${version}.tgz
tar xfzp sample_data-${i}-${version}.tgz
test_args=${test_args}" --"${i}
done

# get met_test data because some cases use this data still
curl -L -O https://github.com/NCAR/METplus/releases/download/v3.0/sample_data-met_test-9.0.tgz
tar xfzp sample_data-met_test-9.0.tgz

# get GempakToCF jar file in case any use cases use GEMPAK data
curl -L -O https://dtcenter.org/sites/default/files/community-code/metplus/utilities/GempakToCF.jar

docker pull ${DOCKERHUB_TAG}
docker images
docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'echo $MY_CUSTOM_VAR;which master_metplus.py;ls -al /metplus;python -V'
docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/use_cases/run_test_use_cases.sh docker ${test_args}
returncode=$?

# Dump the output directories from running METplus
#ls -alR ${OWNER_BUILD_DIR}/test-use-case-output

# Dump and see how much space is left on Travis disk.
df -h

exit $returncode
1 change: 0 additions & 1 deletion internal_tests/use_cases/metplus_test_env.docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export METPLUS_TEST_METPLUS_BASE=

# version of METplus to test
export METPLUS_TEST_MET_INSTALL_DIR=/usr/local
#export METPLUS_TEST_MET_INSTALL_DIR=/d1/projects/MET/MET_releases/met-9.0_beta4

# location to write output from test run
export METPLUS_TEST_OUTPUT_BASE=/metplus/test-use-case-output
Expand Down
2 changes: 1 addition & 1 deletion internal_tests/use_cases/run_test_use_cases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ fi

source $test_env_file

python $script_dir/test_use_cases.py
python $script_dir/test_use_cases.py $@
Loading

0 comments on commit 7fb6fe9

Please sign in to comment.