Skip to content

Commit

Permalink
Add configureable timeout to test-go.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
puerco committed Sep 18, 2020
1 parent c3e0263 commit 6e427eb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion hack/test-go.sh
Expand Up @@ -16,8 +16,25 @@

set -euo pipefail

# Default timeout is 900s
TEST_TIMEOUT=900

for arg in "$@"
do
case $arg in
-t=*|--timeout=*)
TEST_TIMEOUT="${arg#*=}"
shift
;;
-t|--timeout)
TEST_TIMEOUT="$2"
shift
shift
esac
done

REPO_ROOT=$(git rev-parse --show-toplevel)
cd "${REPO_ROOT}"

GO111MODULE=on go test -v -count=1 -cover -coverprofile coverage.out ./...
GO111MODULE=on go test -v -timeout="${TEST_TIMEOUT}s" -count=1 -cover -coverprofile coverage.out ./...
go tool cover -html coverage.out -o coverage.html

0 comments on commit 6e427eb

Please sign in to comment.