talos/hack/golang/test.sh
Andrey Smirnov 5d5697e398 chore: limit unit-test run concurrency
As we run unit-tests concurrently, it makes sense to limit each run
concurrency.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-12-07 10:46:02 -08:00

38 lines
620 B
Bash
Executable File

#!/bin/sh
set -e
# Set up common test environment variables
export PLATFORM=container
perform_tests() {
echo "Performing tests on $1"
go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 -p 4 "$1"
}
perform_race_tests() {
echo "Performing race tests on $1"
CGO_ENABLED=1 go test -v -race -count 1 -p 4 "$1"
}
perform_short_tests() {
echo "Performing short tests on $1"
go test -v -short -count 1 -p 4 "$1"
}
case $1 in
--race)
shift
perform_race_tests "${1:-./...}"
;;
--short)
shift
perform_short_tests "${1:-./...}"
;;
*)
perform_tests "${1:-./...}"
;;
esac
exit 0