interop/tools/consistency.sh
ArkadyKanevsky a9fbc452a6 Reorganize guidelines and improve consistency.sh
Reorganize guidelines into previous_guideline directory
and current_guideline that is softlink to the latest approved guideline.
Cleaned up some tooling that hardwired where guidelines lived.

Change-Id: Ia6be9ca6326718488ee5668df3806da5f76dc456
2021-05-23 10:02:02 +00:00

114 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
# This script will run consistency checks for Tempest tests against
# the current and next interoperability guidelines. It can run in two
# modes.
#
# * If no arguments are specified, the script will check out Tempest and
# tempest plugins into a temporary directory, run the consistency checks,
# then delete temporary checkout.
#
# * If an argument is given, this script will assume that it is a
# user checked-out repository and run the consistency checks against
# that, and leave the directory unchanged on exit. This mode is useful
# for gate jobs and Tempest/tempest plugin development.
set -x
# Prints help
function usage {
SCRIPT_NAME="basename ${BASH_SOURCE[0]}"
echo "Usage: ${SCRIPT_NAME} [OPTION]..."
echo "Consistency check"
echo ""
echo " -h Print this usage message"
echo " -t Local Tempest directory"
echo " -d Local designate-tempest-plugin directory"
echo " -o Local heat-tempest-plugin directory"
echo " -s Local manila-tempest-plugin directory"
echo " -c Set if tempest and plugins directory should be removed after"
echo " the consistency check"
exit 1
}
while getopts t:d:o:s:ch FLAG; do
case ${FLAG} in
t)
TEMPESTDIR=${OPTARG}
;;
d)
DNSDIR=${OPTARG}
;;
o)
ORCHESTRATIONDIR=${OPTARG}
;;
s)
SFSDIR=${OPTARG}
;;
c)
CLEANTEMPEST=true
;;
h) #show help
usage
;;
\?) #unrecognized option - show help
echo -e \\n"Option -$OPTARG not allowed."
usage
;;
esac
done
# check if a local directory was given (for Tempest or one of the plugins),
# if not, create a temp dir and clone the project there
if [[ -z $TEMPESTDIR ]]; then
TEMPESTDIR=$(mktemp -d)
git clone https://opendev.org/openstack/tempest $TEMPESTDIR
fi
if [[ -z $DNSDIR ]]; then
DNSDIR=$(mktemp -d)
git clone https://opendev.org/openstack/designate-tempest-plugin $DNSDIR
fi
if [[ -z $ORCHESTRATIONDIR ]]; then
ORCHESTRATIONDIR=$(mktemp -d)
git clone https://opendev.org/openstack/heat-tempest-plugin $ORCHESTRATIONDIR
fi
if [[ -z $SFSDIR ]]; then
SFSDIR=$(mktemp -d)
git clone https://opendev.org/openstack/manila-tempest-plugin $SFSDIR
fi
export PYTHONPATH=$TEMPESTDIR:$DNSDIR:$ORCHESTRATIONDIR:$SFSDIR
python3 ./tools/checktests.py --guideline next.json
exit_1=$?
# TODO(kopecmartin) consistency check is commented out temporarily while we fix
# inconsistency issues in the follow-up patches
# python3 ./tools/checktests.py --guideline add-ons/dns.next.json --testlib designate_tempest_plugin
# exit_2=$?
# python3 ./tools/checktests.py --guideline add-ons/orchestration.next.json --testlib heat_tempest_plugin
# exit_3=$?
# python3 ./tools/checktests.py --guideline add-ons/shared_file_system.next.json --testlib manila_tempest_tests
# exit_4=$?
python3 ./tools/checktests.py --guideline current_guideline
exit_5=$?
# python3 ./tools/checktests.py --guideline add-ons/dns_current_guideline --testlib designate_tempest_plugin
# exit_6=$?
# python3 ./tools/checktests.py --guideline add-ons/orchestration_current_guideline --testlib heat_tempest_plugin
# exit_7=$?
# python3 ./tools/checktests.py --guideline add-ons/shared_file_system_current_guideline --testlib manila_tempest_tests
# exit_8=$?
if [[ "${CLEANTEMPEST}" ]]; then
rm -rf $TEMPESTDIR
rm -rf $DNSDIR
rm -rf $ORCHESTRATIONDIR
rm -rf $SFSDIR
fi
# ! (( $exit_1 || $exit_2 || $exit_3 || $exit_4 || $exit_5 || $exit_6 || $exit_7 || $exit_8 ))
! (( $exit_1 || $exit_5 ))