Workhorse: Fix transient test failure due to the race condition
Overview
We have a transient test failure: https://gitlab.com/gitlab-org/gitlab/-/jobs/5748864998
- It seems that we don’t have a race condition in the production codebase because we lock/unlock properly
- But we may need to use locking when we access the shared resource in tests as well in order to reliably fix this transient failure
Problem
The internal/upload/destination/objectstore/s3_session_test.go
file contains reads from shared resources without locking.
Proposal
Create getS3Sessions
function in the test file lock/unlock the shared resource properly. Example
Edited by Igor Drozdov