Skip to content

Commit d34a25c

Browse files
committed
tests_macos_gitlab_arm64 flakiness: extend go build isolation in pkgconfigusage (#43773)
### What does this PR do? Add `GOCACHE` isolation to `TestAll` in `pkg/linters/components/pkgconfigusage` to reduce test timeouts on macOS CI runners. ### Motivation The test still times out occasionally ([example in `main`](http://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1267508733/viewer#L2040)) after 3 minutes on macOS Gitlab runners when running with `-p 12 -parallel 12`, despite previous tentative fix (#43207) which added `GOPRIVATE=*` and `GOPROXY=off`. `analysistest.Run` internally runs `go build` commands to verify the Go toolchain works. When multiple tests run concurrently with the same shared `GOCACHE`, they can deadlock in Go's process management layer (see golang/go#59657). ### Changes Added per-test isolated `GOCACHE` directory using `t.TempDir()`, following the same approach as PR #39687 which fixed a similar timeout issue in `comp/core/secrets/impl/fetch_secret_test.go`. ### Describe how you validated your changes Verified locally with `go test -v -race -count=20 -parallel 12 -timeout 600s`. ### Additional Notes Prior art include: - #39518 - #39687 - #43207 - #43627 💡 `-mod=vendor` could be also factored out through a future PR should the problem manifest itself again after the present change is merged.
1 parent 15fd09a commit d34a25c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/linters/components/pkgconfigusage/pkgconfigusage_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
func TestAll(t *testing.T) {
1818
// Set environment variables to prevent go commands from accessing
1919
// the module cache concurrently, which can cause timeouts on macOS.
20+
t.Setenv("GOCACHE", t.TempDir())
2021
t.Setenv("GOPRIVATE", "*")
2122
t.Setenv("GOPROXY", "off")
2223

0 commit comments

Comments
 (0)