test:Fix two potential goroutine leaks (#8964)

Signed-off-by: lzhfromustc <lzhfromustc@gmail.com>
pull/9620/head
lzhfromustc 4 years ago committed by GitHub
parent 5afa606ecb
commit d42be7be76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      discovery/manager_test.go
  2. 1
      storage/remote/queue_manager_test.go

@ -1371,7 +1371,11 @@ func (tp mockdiscoveryProvider) Run(ctx context.Context, upCh chan<- []*targetgr
for i := range u.targetGroups {
tgs[i] = &u.targetGroups[i]
}
upCh <- tgs
select {
case <-ctx.Done():
return
case upCh <- tgs:
}
}
<-ctx.Done()
}

@ -408,6 +408,7 @@ func TestReleaseNoninternedString(t *testing.T) {
c := NewTestWriteClient()
m := NewQueueManager(metrics, nil, nil, nil, "", newEWMARate(ewmaWeight, shardUpdateDuration), cfg, mcfg, nil, nil, c, defaultFlushDeadline, newPool(), newHighestTimestampMetric(), nil, false)
m.Start()
defer m.Stop()
for i := 1; i < 1000; i++ {
m.StoreSeries([]record.RefSeries{

Loading…
Cancel
Save