Commit b030948
[Backport 7.74.x]
**Cherry-picked** from #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.
Co-authored-by: spencer.gilbert <[email protected]>tests_macos_gitlab_arm64 flakiness: extend go build isolation in pkgconfigusage (#43853)1 parent 15fd09a commit b030948
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments