Skip to content

Commit

Permalink
fix: lock mutex in tests because of -race failing
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaranski committed Dec 13, 2024
1 parent 30b0ca8 commit 9df26ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fileshare/event_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,12 @@ func TestTransferProgress(t *testing.T) {
assert.Equal(t, pb.Status_SUCCESS, progressEvent.Status)

waitGroup.Wait()
eventManager.mutex.Lock() // required so that go test -race doesn't fail, normally it's not needed
_, ok := eventManager.transferSubscriptions[transferID]
assert.False(t, ok) // expect subscriber to be removed
_, ok = eventManager.liveTransfers[transferID]
assert.False(t, ok) // expect transfer not to be tracked anymore
eventManager.mutex.Unlock()
}

func TestAcceptTransfer(t *testing.T) {
Expand Down

0 comments on commit 9df26ce

Please sign in to comment.