k3s/tests/integration/test-runner.sh

30 lines
741 B
Bash
Executable File

#!/bin/sh
set -x
results_dir="${RESULTS_DIR:-/tmp/results}"
# saveResults prepares the results for handoff to the Sonobuoy worker.
# See: https://github.com/vmware-tanzu/sonobuoy/blob/master/site/content/docs/master/plugins.md
saveResults() {
cd ${results_dir}
# Sonobuoy worker expects a tar file.
tar czf results.tar.gz *
# Signal to the worker that we are done and where to find the results.
printf ${results_dir}/results.tar.gz > ${results_dir}/done
}
# Ensure that we tell the Sonobuoy worker we are done regardless of results.
trap saveResults EXIT
runTests() {
cd ./tests
for t in *.test; do
# Run each test (automatically saves the output in the results directory).
./$t
done
}
runTests