diff --git a/Makefile b/Makefile index d2c82b033..501de2fc4 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ACCEPTANCE_RUN_TESTS=. PKG := ./... TAGS := TESTS := . -TESTFLAGS := +TESTFLAGS := -shuffle=on LDFLAGS := -w -s GOFLAGS := CGO_ENABLED ?= 0 @@ -116,10 +116,11 @@ test-unit: .PHONY: test-coverage +test-coverage: TESTFLAGS += -count=3 test-coverage: @echo @echo "==> Running unit tests with coverage <==" - @ ./scripts/coverage.sh + @ TESTFLAGS="${TESTFLAGS}" ./scripts/coverage.sh .PHONY: test-style test-style: diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 2d8258866..61a486d32 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -16,6 +16,8 @@ set -euo pipefail +TESTFLAGS=${TESTFLAGS:-} + covermode=${COVERMODE:-atomic} coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX) profile="${coverdir}/cover.out" @@ -28,7 +30,7 @@ generate_cover_data() { for d in $(go list ./...) ; do ( local output="${coverdir}/${d//\//-}.cover" - go test -coverprofile="${output}" -covermode="$covermode" "$d" + go test ${TESTFLAGS} -coverprofile="${output}" -covermode="$covermode" "$d" ) done