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) (#42287)

fix race condition in TestQueueProducerBlocksUntilOutputIsSet

(cherry picked from commit 57eae3a)

Co-authored-by: kruskall <[email protected]>
  • Loading branch information
mergify[bot] and kruskall authored Jan 15, 2025
1 parent 85785cb commit 5a999a7
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 5a999a7

Please sign in to comment.