Skip to content

Commit

Permalink
test: acquire lock before checking pendingRequests in controller test (
Browse files Browse the repository at this point in the history
…#42096)

fix race condition in TestQueueProducerBlocksUntilOutputIsSet
  • Loading branch information
kruskall authored Jan 10, 2025
1 parent d288e54 commit 57eae3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libbeat/publisher/pipeline/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ func TestQueueProducerBlocksUntilOutputIsSet(t *testing.T) {
}()
}
allStarted := waitUntilTrue(time.Second, func() bool {
controller.queueLock.Lock()
defer controller.queueLock.Unlock()
return len(controller.pendingRequests) == producerCount
})
assert.True(t, allStarted, "All queueProducer requests should be saved as pending requests by outputController")
Expand Down

0 comments on commit 57eae3a

Please sign in to comment.