Skip to content

Commit e053df5

Browse files
authored
[chore][processor/groupbytrace] fix flaky TestEventShutdown (#44548)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description We should wait for the shutdown call to return before checking for expired events, because the shutdown goroutine might not be able to acquire the lock in a timely manner. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #44533
1 parent 36a7cf3 commit e053df5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

processor/groupbytraceprocessor/event_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,16 @@ func TestEventShutdown(t *testing.T) {
425425
// verify
426426
assert.Equal(t, int64(1), traceReceivedFired.Load())
427427

428+
// wait until the shutdown has returned
429+
shutdownWg.Wait()
430+
428431
// If the code is wrong, there's a chance that the test will still pass
429432
// in case the event is processed after the assertion.
430433
// Verify that the expired event is not processed (should remain 0)
431434
assert.Eventually(t, func() bool {
432435
return traceExpiredFired.Load() == 0
433436
}, 100*time.Millisecond, 5*time.Millisecond)
434437
assert.Equal(t, int64(0), traceExpiredFired.Load())
435-
436-
// wait until the shutdown has returned
437-
shutdownWg.Wait()
438438
}
439439

440440
func TestPeriodicMetrics(t *testing.T) {

0 commit comments

Comments
 (0)