From cd6c20daf14d2b2a51386238728acecc8e126db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Thu, 1 Oct 2020 12:08:35 +0200 Subject: [PATCH] Run tests without -race on Windows to minimize flakiness Resolves https://github.com/loadimpact/k6/pull/1640#discussion_r498111943 --- .github/workflows/all.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 6dff1853fa02..2d249484461e 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -75,9 +75,17 @@ jobs: go-version: ${{ matrix.go-version }} - name: Run tests run: | + set -x go version export GOMAXPROCS=2 - go test -p 2 -race -timeout 800s ./... + args=("-p" "2" "-race") + # Run with less concurrency on Windows to minimize flakiness. + if [[ "${{ matrix.platform }}" == windows* ]]; then + unset args[2] + args[1]="1" + export GOMAXPROCS=1 + fi + go test "${args[@]}" -timeout 800s ./... test-cov: strategy: @@ -98,6 +106,13 @@ jobs: run: | go version export GOMAXPROCS=2 + args=("-p" "2" "-race") + # Run with less concurrency on Windows to minimize flakiness. + if [[ "${{ matrix.platform }}" == windows* ]]; then + unset args[2] + args[1]="1" + export GOMAXPROCS=1 + fi echo "mode: set" > coverage.txt for pkg in $(go list ./... | grep -v vendor); do list=$(go list -test -f '{{ join .Deps "\n"}}' $pkg | grep github.com/loadimpact/k6 | grep -v vendor || true) @@ -105,7 +120,7 @@ jobs: list=$(echo "$list" | cut -f1 -d ' ' | sort -u | paste -sd, -) fi - go test -race -timeout 800s --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg + go test "${args[@]}" -timeout 800s --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg done grep -h -v "^mode:" *.coverage >> coverage.txt rm -f *.coverage