From 53e034ce0be31155bf0b982ac02fbffc0924fc79 Mon Sep 17 00:00:00 2001 From: ucwong Date: Thu, 2 Apr 2020 22:01:18 +0800 Subject: [PATCH] metrics: add missing calls to Ticker.Stop in tests (#20866) --- metrics/meter_test.go | 1 + metrics/sample_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/metrics/meter_test.go b/metrics/meter_test.go index 0302c947d8..28472253e8 100644 --- a/metrics/meter_test.go +++ b/metrics/meter_test.go @@ -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() diff --git a/metrics/sample_test.go b/metrics/sample_test.go index 3250d88857..c9168d3e82 100644 --- a/metrics/sample_test.go +++ b/metrics/sample_test.go @@ -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: