talos/hack/golang/test.sh
Andrey Smirnov 029374f07d chore: disable go test result cache
Go by default caches unit-tests results via build cache, so if source
code doesn't have any changes, test results are cached on package level.
As our unit-tests are not that pure and depend on the environment, it
would be more helpful to make sure all the unit-tests during each build.

Setting number of test runs to one disable test result cache (but build
cache is still being used).

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-08-30 22:03:00 +03:00

26 lines
367 B
Bash
Executable File

#!/bin/sh
set -e
perform_tests() {
echo "Performing tests on $1"
go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 "$1"
}
perform_short_tests() {
echo "Performing short tests on $1"
go test -v -short -count 1 "$1"
}
case $1 in
--short)
shift
perform_short_tests "${1:-./...}"
;;
*)
perform_tests "${1:-./...}"
;;
esac
exit 0