Skip to content

Commit

Permalink
Don't block on goroutines returning in processor_test.go
Browse files Browse the repository at this point in the history
Blocking on all goroutines fully returning is not necssary
to appearse goleak. See:
https://github.com/jaegertracing/jaeger/pull/5310/files/dfe7adc7fd34389e2e507d9512eb64b5e19048f7#r1544603132

Signed-off-by: Will Sewell <[email protected]>
  • Loading branch information
Will Sewell committed Mar 29, 2024
1 parent dfe7adc commit f456039
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions plugin/sampling/strategystore/adaptive/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,8 @@ func TestRunCalculationLoop_GetThroughputError(t *testing.T) {
p, err := newProcessor(cfg, "host", mockStorage, mockEP, metrics.NullFactory, logger)
require.NoError(t, err)
p.shutdown = make(chan struct{})
done := make(chan struct{})
go func() {
p.runCalculationLoop()
close(done)
}()
defer func() {
close(p.shutdown)
<-done
}()
defer close(p.shutdown)
go p.runCalculationLoop()

for i := 0; i < 1000; i++ {
// match logs specific to getThroughputErrMsg. We expect to see more than 2, once during
Expand Down Expand Up @@ -439,17 +432,10 @@ func TestRunUpdateProbabilitiesLoop(t *testing.T) {
followerRefreshInterval: time.Millisecond,
electionParticipant: mockEP,
}
defer close(p.shutdown)
require.Nil(t, p.probabilities)
require.Nil(t, p.strategyResponses)
done := make(chan struct{})
go func() {
p.runUpdateProbabilitiesLoop()
close(done)
}()
defer func() {
close(p.shutdown)
<-done
}()
go p.runUpdateProbabilitiesLoop()

for i := 0; i < 1000; i++ {
p.RLock()
Expand Down

0 comments on commit f456039

Please sign in to comment.