diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 81cbd11493e..a5ac94fe367 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -202,8 +202,6 @@ type periodicReaderTestSuite struct { } func (ts *periodicReaderTestSuite) SetupTest() { - ts.Reader = ts.Factory() - e := &fnExporter{ exportFunc: func(context.Context, *metricdata.ResourceMetrics) error { return assert.AnError }, flushFunc: func(context.Context) error { return assert.AnError }, @@ -429,12 +427,13 @@ func TestPeriodicReaderMultipleForceFlush(t *testing.T) { r.register(testSDKProducer{}) require.NoError(t, r.ForceFlush(ctx)) require.NoError(t, r.ForceFlush(ctx)) + require.NoError(t, r.Shutdown(ctx)) } func BenchmarkPeriodicReader(b *testing.B) { - b.Run("Collect", benchReaderCollectFunc( - NewPeriodicReader(new(fnExporter)), - )) + r := NewPeriodicReader(new(fnExporter)) + b.Run("Collect", benchReaderCollectFunc(r)) + require.NoError(b, r.Shutdown(context.Background())) } func TestPeriodiclReaderTemporality(t *testing.T) {