From 54e698336825979a1972ae29a73c07c6dcc40cf7 Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Tue, 22 Jun 2021 11:28:43 -0700 Subject: [PATCH] :seedling: Disable parallel go test executions on MacOS Signed-off-by: Vince Prignano --- hack/test-all.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hack/test-all.sh b/hack/test-all.sh index 42d64f006f..d2680c25ce 100755 --- a/hack/test-all.sh +++ b/hack/test-all.sh @@ -20,7 +20,18 @@ source $(dirname ${BASH_SOURCE})/common.sh header_text "running go test" -go test -race ${MOD_OPT} ./... +# On MacOS there is a strange race condition +# between port allocation of envtest suites when go test +# runs all the tests in parallel (spins up around 10 or so environments). +# +# To avoid flakes, set -p=1 to disable parallel go test executions. +# +# TODO(community): Investigate this behavior further. +if [[ "${OSTYPE}" == "darwin"* ]]; then + P_FLAG="-p=1" +fi + +go test -race ${P_FLAG} ${MOD_OPT} ./... if [[ -n ${ARTIFACTS:-} ]]; then if grep -Rin '' ${ARTIFACTS}/*; then exit 1; fi