Skip to content

Commit

Permalink
fix: concurrent tests having race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinHood3082 committed Oct 20, 2024
1 parent 842ba5e commit bfa3bd2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ func TestConcurrentAccess(t *testing.T) {
return &AnotherTestService{ID: 1}
})
var factoryCounter int
var mu sync.Mutex

locator.RegisterFactory(sl, func() int {
mu.Lock()
defer mu.Unlock()
factoryCounter++
return factoryCounter
})
Expand Down

0 comments on commit bfa3bd2

Please sign in to comment.