From f2463358c4f1f29caa289b08e81ba213f6f7d79f Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Thu, 25 Aug 2022 13:31:36 +0530 Subject: [PATCH] Limit GOMAXPROCS while running race tests (#20881) In CI environment, race tests take a huge amount of memory. Since we only run it on master, there's no rush to finish it quickly. Hence we can limit the parallelism and throttle memory usage. ```release-note NONE ``` --- scripts/test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/test.sh b/scripts/test.sh index 6e345b1e8f..63f89fc785 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -18,6 +18,11 @@ export MM_SERVER_PATH=$PWD echo "Packages to test: $PACKAGES" echo "GOFLAGS: $GOFLAGS" +if [[ $GOFLAGS == "-race " && $IS_CI == "true" ]] ; +then + export GOMAXPROCS=4 +fi + find . -name 'cprofile*.out' -exec sh -c 'rm "{}"' \; find . -type d -name data -not -path './data' | xargs rm -rf