#!/usr/bin/env bash

#####
# This script sets up the environment needed to perform the integration tests.
# 1. Build all the images
# 2. Launch all the docker containers.
# After this, tests can be run and shutdown needs to be issued after that.
#####

set -euo pipefail

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

# The all_img_build.sh script has all the smartness, just run it from here
${intgtest}/../scripts/all_img_build.sh
exit_code=$?
if [ $exit_code -ne 0 ]
then
    exit $exit_code
fi
echo

# Start all the containers
${intgtest}/../scripts/local_launch.sh

exit $?
