Fix flaky tests
What does this MR do?
- Fix logrus race conditions with logger
Tests were using logrus.StandardLogger(), a global singleton, which
caused data races when tests ran in parallel with
t.Parallel(). Multiple goroutines were simultaneously writing to and
reading from the same logger's internal buffer.
Sample failure: https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/12373486144
Solution:
-
retry_requester_test.go: Add a test-specific logger using test.NewNullLogger() -
gitlab_test.go: Changedlogrus.StandardLogger()tologrus.New()to create a new logger instance for each test run
- Increase timeout in TestDockerCommandOwnershipOverflow
This test takes about 22 seconds on my local system. It might be taking longer to complete in CI, so extend the timeout from 1 to 2 minutes.
Sample failure: https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/12373486161
Edited by Stan Hu