Skip to content

Commit

Permalink
bug: fix flaky test TestQueuedRetry_RequeuingEnabled (#8989)
Browse files Browse the repository at this point in the history
fixes a flaky test 
Fixing a bug - TestQueuedRetry_RequeuingEnabled has been failing
occasionally. Upon investigation, `be.send` calls the underlying
`observabilityConsumerSender.send` which calls `wg.Done()`, so we need
to add `wg.Add(1)` before that

Fixes #6624

**Testing:** Ran the same test multiple times before/after change: `go
test -race -run TestQueuedRetry_RequeuingEnabled -count 1000`
  • Loading branch information
berkeli committed Nov 24, 2023
1 parent 3b56bd0 commit c21ea16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exporter/exporterhelper/queue_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ func TestQueuedRetry_RequeuingEnabled(t *testing.T) {
traceErr := consumererror.NewTraces(errors.New("some error"), testdata.GenerateTraces(1))
mockR := newMockRequest(1, traceErr)
ocs.run(func() {
ocs.waitGroup.Add(1) // necessary because we'll call send() again after requeueing
// This is asynchronous so it should just enqueue, no errors expected.
require.NoError(t, be.send(context.Background(), mockR))
ocs.waitGroup.Add(1) // necessary because we'll call send() again after requeueing
})
ocs.awaitAsyncProcessing()

Expand Down

0 comments on commit c21ea16

Please sign in to comment.