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
This commit is contained in:
@@ -30,17 +30,18 @@ function run-test()
|
|||||||
base=$(go list .)
|
base=$(go list .)
|
||||||
if [[ "$@" = *"--integration"* ]]; then
|
if [[ "$@" = *"--integration"* ]]; then
|
||||||
if [[ "$@" = *"--race"* ]]; 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
|
else
|
||||||
GOCACHE=off run-test go test "${base}/integration" -v ${XTAGS}
|
run-test go test -count=1 "${base}/integration" -v ${XTAGS}
|
||||||
fi
|
fi
|
||||||
else
|
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
|
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"
|
echo -e "\ttesting: $pkg"
|
||||||
if [[ "$@" = *"--race"* ]]; then
|
if [[ "$@" = *"--race"* ]]; then
|
||||||
GOCACHE=off run-test go test -race "$pkg" ${XTAGS}
|
run-test go test -count=1 -race "$pkg" ${XTAGS}
|
||||||
else
|
else
|
||||||
GOCACHE=off run-test go test "$pkg" ${XTAGS}
|
run-test go test -count=1 "$pkg" ${XTAGS}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user