From 7d641427d261dee9c607d234a23375b6897b7064 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 10 Jan 2019 20:41:10 -0500 Subject: [PATCH] test: Fix golang cache regression Golang decided to change the GOCACHE behaviour in newer versions of `go test`. This changes our tests to use the new approach. For users using a local `.envrc`, you might want to add: GOFLAGS="-count=1" Which is supposed to fix this problem for local tests. More information is available in: https://github.com/golang/go/issues/29378 --- test/test-gotest.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test-gotest.sh b/test/test-gotest.sh index d8dab4ce..35e054c0 100755 --- a/test/test-gotest.sh +++ b/test/test-gotest.sh @@ -30,17 +30,18 @@ function run-test() base=$(go list .) if [[ "$@" = *"--integration"* ]]; then if [[ "$@" = *"--race"* ]]; then - GOCACHE=off run-test go test -race "${base}/integration" -v ${XTAGS} + # adding -count=1 replaces the GOCACHE=off fix that was removed + run-test go test -count=1 -race "${base}/integration" -v ${XTAGS} else - GOCACHE=off run-test go test "${base}/integration" -v ${XTAGS} + run-test go test -count=1 "${base}/integration" -v ${XTAGS} fi else for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old" | grep -v "^${base}/old/" | grep -v "^${base}/tmp" | grep -v "^${base}/tmp/" | grep -v "^${base}/integration"`; do echo -e "\ttesting: $pkg" if [[ "$@" = *"--race"* ]]; then - GOCACHE=off run-test go test -race "$pkg" ${XTAGS} + run-test go test -count=1 -race "$pkg" ${XTAGS} else - GOCACHE=off run-test go test "$pkg" ${XTAGS} + run-test go test -count=1 "$pkg" ${XTAGS} fi done fi