Files
dokku/tests/ci/unit_test_runner.sh
Jose Diaz-Gonzalez dac566e75e refactor: move all shellcheck disable definitions to .shellcheckrc file
This makes standard use of shellcheck work without needing to provide extra configuration anywhere.

Also remove use of inline 'shellcheck disable' calls that are already defined in the .shellcheckrc and don't need to be set inline.
2023-08-05 10:58:57 -04:00

39 lines
681 B
Bash
Executable File

#!/usr/bin/env bash
is_number() {
local NUMBER=$1
local NUM_RE='^[1-4]+$'
if [[ $NUMBER =~ $NUM_RE ]]; then
return 0
else
return 1
fi
}
usage() {
echo "usage: $0 1|2|3|4"
exit 0
}
BATCH_NUM="$1"
is_number "$BATCH_NUM" || usage
TESTS=$(find "$(dirname "$0")/../unit" -maxdepth 1 -name "${BATCH_NUM}0*.bats" | sort -n | xargs)
echo "running the following tests $TESTS"
for test in $TESTS; do
echo $test
starttest=$(date +%s)
bats $test
RC=$?
if [[ $RC -ne 0 ]]; then
echo "exit status: $RC"
exit $RC
fi
endtest=$(date +%s)
testruntime=$((endtest - starttest))
echo "individual runtime: $(date -u -d @${testruntime} +"%T")"
done