From 760ea1b88584ac6be7b1fa6a182423895902403b Mon Sep 17 00:00:00 2001 From: Rob Gonzalez-Pita Date: Wed, 15 Sep 2021 10:43:53 -0600 Subject: [PATCH] Add end to end test script. (#179) * Add end to end tests for Hera * Update end to end script * Update CODEOWNERS to the team working on the rrfs_ci branch * Modify and use APP_DIR variable instead of BRANCH_DIR_NAME to exclude using branch name at the end of the repo directory * Change executable permissions to end_to_end_tests.sh * Moving script consistent with new dir. * Remove old script. * Clean up a few minor things. * Update TESTS_DIR to point to the correct directory Co-authored-by: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Co-authored-by: Christina Holt --- .github/CODEOWNERS | 14 +---- tests/WE2E/end_to_end_tests.sh | 97 ++++++++++++++++++++++++++++++++++ ush/launch_FV3LAM_wflow.sh | 14 +++++ 3 files changed, 113 insertions(+), 12 deletions(-) create mode 100755 tests/WE2E/end_to_end_tests.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 40196de74..760e0cefb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,14 +1,4 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. -# These owners will be the default owners for everything in the repo. -#* @defunkt -* @JulieSchramm @mkavulich @gsketefian @JeffBeck-NOAA @RatkoVasic-NOAA @BenjaminBlake-NOAA +# These owners will be the default owners for the rrfs_ci branch of this repo. +* @robgonzalezpita @christopherwharrop-noaa @christinaholtNOAA @venitahagerty -# Order is important. The last matching pattern has the most precedence. -# So if a pull request only touches javascript files, only these owners -# will be requested to review. -#*.js @octocat @github/js - -# You can also use email addresses if you prefer. -#docs/* docs@example.com diff --git a/tests/WE2E/end_to_end_tests.sh b/tests/WE2E/end_to_end_tests.sh new file mode 100755 index 000000000..3491ac3b5 --- /dev/null +++ b/tests/WE2E/end_to_end_tests.sh @@ -0,0 +1,97 @@ +#!/bin/bash -l + +#---------------------------------------------------------------------- +# Automation of UFS Short Range Weather App Worfklow End to End Tests. +# +# The script is dependant on a successful build of this repo using the +# test/build.sh script in the ufs-srweather-app repository. +# The UFS build must be completed in a particular manner for this +# script to function properly, notably the location of the build and +# bin directories: +# BUILD_DIR=${APP_DIR}/build_${compiler} +# BIN_DIR=${APP_DIR}/bin_${compiler} +# +# With the creating of a test_log directory and output files describing +# the result of each workflow status, a testing framework is established. +# The user must verify the contents of each experiment file in test_log/ +# to check workflow success or failure. +# +# Example: ./end_to_end_tests.sh hera zrtrr +#---------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Set variables +#----------------------------------------------------------------------- + +branches=( rrfs_ci ) + +function usage { + echo + echo "Usage: $0 machine slurm_account | -h" + echo + echo " machine [required] is one of: ${machines[@]}" + echo " slurm_account [required] case sensitive name of the user-specific slurm account" + echo " -h display this help" + echo + exit 1 + +} + +machines=( hera ) + +if [ "$1" = "-h" ] ; then usage ; fi +[[ $# -le 1 ]] && usage + +export machine=$1 +machine=$(echo "${machine}" | tr '[A-Z]' '[a-z]') # scripts in sorc need lower case machine name + +export account=$2 + +#----------------------------------------------------------------------- +# Choose experiment. +#----------------------------------------------------------------------- + +expts=( grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GSD_SAR ) + +#----------------------------------------------------------------------- +# Set directories +#----------------------------------------------------------------------- + +scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" ) +scrfunc_fn=$( basename "${scrfunc_fp}" ) +scrfunc_dir=$( dirname "${scrfunc_fp}" ) + +TESTS_DIR=$( dirname "${scrfunc_dir}" ) +REGIONAL_WORKFLOW_DIR=$( dirname "${TESTS_DIR}" ) +SRW_APP_DIR=$( dirname "${REGIONAL_WORKFLOW_DIR}" ) +TOP_DIR=$( dirname "${SRW_APP_DIR}" ) + +#BRANCH_DIR_NAME=ufs-srweather-app-${branches} +APP_DIR=${TOP_DIR}/ufs-srweather-app +EXPTS_DIR=${TOP_DIR}/expt_dirs + +#---------------------------------------------------------------------- +# Temporary fix to set EXECDIR in setup.sh appropriately. +#---------------------------------------------------------------------- + +sed -i 's|EXECDIR="${SR_WX_APP_TOP_DIR}/bin"|EXECDIR="${SR_WX_APP_TOP_DIR}/bin_intel/bin"|g' "${REGIONAL_WORKFLOW_DIR}/ush/setup.sh" + +#----------------------------------------------------------------------- +# Run E2E Tests +#----------------------------------------------------------------------- + +# Load Python Modules +cmd="${APP_DIR}/env/wflow_${machine}.env" +source ${cmd} + +echo "-- Load environment =>" $cmd + +# If experiments list file exists, remove it, and add the experiemnts to a new expts list file +auto_file="auto_expts_list.txt" + +rm -rf ${auto_file} +echo ${expts} > ${auto_file} + +# Run the E2E Workflow tests +./run_WE2E_tests.sh tests_file=${auto_file} machine=${machine} account=${account} + diff --git a/ush/launch_FV3LAM_wflow.sh b/ush/launch_FV3LAM_wflow.sh index 453db87d3..3678d0a5c 100755 --- a/ush/launch_FV3LAM_wflow.sh +++ b/ush/launch_FV3LAM_wflow.sh @@ -372,6 +372,20 @@ status): expt_name = \"${expt_name}\" wflow_status = \"${wflow_status}\" " + +# +# Additions for RRFS_CI E2E Tests: +# +RRFS_DIR=$(dirname "${scrfunc_dir}") +TESTS_DIR=${RRFS_DIR}/tests +TESTS_LOG_DIR=${TESTS_DIR}/test_log + +if [ ! -d "${TESTS_LOG_DIR}" ] ; then + mkdir -p ${TESTS_LOG_DIR} +fi + +echo ${expt_name} : ${wflow_status} >> ${TESTS_LOG_DIR}/${expt_name} + # # If a cron job was being used to periodically relaunch the workflow, we # now remove the entry in the crontab corresponding to the workflow be-