metrics: add missing calls to Ticker.Stop in tests (#20866)

This commit is contained in:
ucwong 2020-04-02 22:01:18 +08:00 committed by GitHub
parent 0893ee6d51
commit 53e034ce0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -26,6 +26,7 @@ func TestMeterDecay(t *testing.T) {
ticker: time.NewTicker(time.Millisecond),
meters: make(map[*StandardMeter]struct{}),
}
defer ma.ticker.Stop()
m := newStandardMeter()
ma.meters[m] = struct{}{}
go ma.tick()

View File

@ -346,6 +346,7 @@ func TestUniformSampleConcurrentUpdateCount(t *testing.T) {
quit := make(chan struct{})
go func() {
t := time.NewTicker(10 * time.Millisecond)
defer t.Stop()
for {
select {
case <-t.C: