Closed davidharrigan closed 9 months ago
@sywhang any chance we could cut a new release containing this fix / several others in the main branch? I see an issue to fix release actions: https://github.com/uber-go/mock/issues/88, if that is a blocker I'm happy to help if you can provide a description of what you're looking for? Thanks!
This PR is a proposal to add
mutex.Lock
onController.Satisfied
to solve a race condition that can arise when two goroutines are involved in checking whether mock conditions have been satisfied.The use case is illustrated in the
sample/concurrent
package - what I'm hoping to accomplish is where the test scenario contains one goroutine that runs indefinitely that calls mocked functions, I would like to useSatisfied
as one of the conditions to trigger test assertions.Tests added in
sample/concurrent
fails data race check without this change: