Skip to content
65 changes: 38 additions & 27 deletions tests/end_to_end_tests.sh → tests/WE2E/end_to_end_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,55 @@
#----------------------------------------------------------------------
# Automation of UFS Short Range Weather App Worfklow End to End Tests.
#
# The script is dependant on a successful build of this repo.
# 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}
#
# 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.
# to check workflow success or failure.
#
# Example: . end_to_end_tests.sh hera zrtrr
# Example: ./end_to_end_tests.sh hera zrtrr

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I changed the instructions to execute instead of source this scripts. It's a bit safer.

#----------------------------------------------------------------------

#-----------------------------------------------------------------------
# Set variables
#-----------------------------------------------------------------------

branches=( rrfs_ci )
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
Comment thread
robgpita marked this conversation as resolved.

export machine=$1
machine=`echo "${machine}" | tr '[A-Z]' '[a-z]'` # scripts in sorc need lower case machine name
machine=$(echo "${machine}" | tr '[A-Z]' '[a-z]') # scripts in sorc need lower case machine name
Comment thread
robgpita marked this conversation as resolved.

export account=$2
account=`echo "${account}"`

Comment thread
robgpita marked this conversation as resolved.

#-----------------------------------------------------------------------
# Choose experiment. ( Full list in ./baselines_list.txt)
# Choose experiment.
Comment thread
robgpita marked this conversation as resolved.
#-----------------------------------------------------------------------

#expts=( grid_RRFS_CONUS_25km_ics_HRRR_lbcs_RAP_suite_RRFS_v1alpha )
expts=( grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2 )
#expts=( grid_RRFS_CONUS_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2 )
#expts=( grid_RRFS_CONUS_13km_ics_HRRR_lbcs_RAP_suite_HRRR )
#expts=( inline_post )
#expts=( grid_RRFS_CONUS_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2 grid_RRFS_CONUS_25km_ics_HRRR_lbcs_RAP_suite_RRFS_v1alpha )
expts=( grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GSD_SAR )

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removing commented code here.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with removing the commented code, but if we'd like to run more than one experiment in the future, I believe we should provide additional information or some sort of "skeleton".

I left the extras in here to change which experiments to run. It is easy to toggle the commented experiments and re-run this script. As there were errors with finding IC/LBCS with particular experiments, I wanted to have a couple different experiments on deck. I reckon it would be nice to have a way to submit multiple experiments easily.

Do we only want to have one 'test' (experiment) for now?

If we want to accommodate more than one experiment, do we want to provide those as a config file, as CLA, or uncommenting code?


#-----------------------------------------------------------------------
# Set directories
Expand All @@ -50,10 +61,11 @@ scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" )
scrfunc_fn=$( basename "${scrfunc_fp}" )
scrfunc_dir=$( dirname "${scrfunc_fp}" )

REGIONAL_WORKFLOW_DIR=$( dirname "${scrfunc_dir}" )
WE2E_DIR=$( dirname "${scrfunc_dir}" )
TESTS_DIR=$( dirname "${WE2E_DIR}" )
REGIONAL_WORKFLOW_DIR=$( dirname "${TESTS_DIR}" )

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up @christinaholtNOAA

SRW_APP_DIR=$( dirname "${REGIONAL_WORKFLOW_DIR}" )
TOP_DIR=$( dirname "${SRW_APP_DIR}" )
TESTS_DIR=${REGIONAL_WORKFLOW_DIR}/tests

#BRANCH_DIR_NAME=ufs-srweather-app-${branches}
APP_DIR=${TOP_DIR}/ufs-srweather-app
Expand All @@ -70,18 +82,17 @@ sed -i 's|EXECDIR="${SR_WX_APP_TOP_DIR}/bin"|EXECDIR="${SR_WX_APP_TOP_DIR}/bin_i
#-----------------------------------------------------------------------

# Load Python Modules
source ${APP_DIR}/env/wflow_${machine}.env
cmd="${APP_DIR}/env/wflow_${machine}.env"
source ${cmd}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced a bit of duplicate information here by using the variable cmd.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up as well.


echo "-- Python command =>" $cmd
echo "-- Load environment =>" $cmd

# If experiments list file exists, remove it, and add the experiemnts to a new expts list file
if [ -f "auto_expts_list.txt" ] ; then
rm "auto_expts_list.txt"
fi
echo ${expts} > auto_expts_list.txt
auto_file="auto_expts_list.txt"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the file was specified in several locations. If we put it in a variable, we could move it anywhere, and rename and only have to change it in one spot.


rm -rf ${auto_file}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use flags on rm that don't require checking for the existence of the file -- one less file system check, which can be expensive.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Don't know why I didn't simplify this to rm -rf.

echo ${expts} > ${auto_file}

# Run the E2E Workflow tests
#./run_experiments.sh expts_file=auto_expts_list.txt machine=${machine} account=${account} use_cron_to_relaunch=FALSE
./run_experiments.sh expts_file=auto_expts_list.txt machine=${machine} account=${account}
./run_WE2E_tests.sh tests_file=${auto_file} machine=${machine} account=${account}
Comment thread
robgpita marked this conversation as resolved.