#!/usr/bin/env bash
#
# You can use this script to run the tests on the remote qa box
# Requires ssh config with name delphi-qa
# Optionally takes one argument: the test suite name
#

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"

DEFAULT_TEST_SUITE_NAME="delphi-api-test-suite-v3.2.0.jmx"
TEST_SUITE_NAME="${1:-$DEFAULT_TEST_SUITE_NAME}"

./upload-files.sh || exit 1

ssh delphi-qa << EOF
 cd ~/qa-jmeter && ./run-tests.sh ${TEST_SUITE_NAME}
EOF

echo -e "\nFinished running test suite"

./download-reports.sh
