Commit b44d2d6
committed
### 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 b44d2d6
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
0 commit comments