#!/usr/bin/env bash

#####
# This script runs all the tests that are part of integration tests.
# It is dependnet on the setup.sh script.
# After this, shutdown needs to be issued.
#####

set -euo pipefail

# Get the correct directory where the script resides
intgtest="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

######
# Run the varz test first to ensure connectivity
# If it fails, there is no need to run further tests.
#
# The port is determined by the local_launch.sh script
#
cd ${intgtest}
python3 varz_test.py --host localhost --port 8085
if [ $? -ne 0 ]
then
    echo
    echo "===== FAILED to run the varz test. Stopping integration tests."
    echo
    exit 1
fi

#####
# Future tests can be invoked from here
#####

exit 0
