featurebase/qa/scripts/testSmokeTest.sh
Seebs cd6125dfc6 squash auth tests into regular smoke tests, improve smoke tests
This is a bit complicated and entangled, sorry.

First, we squash the auth-based smoke tests into the regular smoke
tests; we just run all the tests with auth on and that way we don't
need to spin up an entire separate cluster of machines just to run
a single query against them.

We improve the error detection, and standardize the jq-to-get-config
code. The purpose of this is to try to make sure that, if we actually
hit a failure and get "null" for a host name, we report *that*
as an error, rather than running ahead and producing 20+ separate
reports that ssh failed because it couldn't find a host named null.
2022-09-30 11:23:17 -07:00

42 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/utilCluster.sh
# get the first ingest host
must_get_value ./qa/tf/ci/smoketest/outputs.json INGESTNODE0 .ingest_ips 0 '"value"' 0
echo "using INGESTNODE0 ${INGESTNODE0}"
HOSTS=($( cat ./qa/tf/ci/smoketest/outputs.json | jq -r '.data_node_ips.value' | tr -d '[],"'))
echo "Copying tests to remote"
if ! scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ./qa/testcases/smoketest/* ./datagen_linux_arm64 ec2-user@${INGESTNODE0}:/data; then
echo >&2 "Copy failed"
exit 1
fi
# run smoke test
echo "Running smoke test..."
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "cd /data; ~/.local/bin/pytest --junitxml=report.xml"
SMOKETESTRESULT=$?
if [ $SMOKETESTRESULT -ne 0 ]; then
echo >&2 "initial smoke tests failed"
exit 1
fi
echo "Copying test report to local"
scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ec2-user@${INGESTNODE0}:/data/report.xml report.xml
if (( $? != 0 ))
then
echo "Copy failed"
exit 1
fi
if (( $SMOKETESTRESULT != 0 ))
then
echo "Smoke test complete with test failures"
else
echo "Smoke test complete"
fi
exit $SMOKETESTRESULT