Skip to content

Commit

Permalink
Fix data race in periodic reader tests (#4731)
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole authored Nov 28, 2023
1 parent 47ba653 commit 204be61
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sdk/metric/periodic_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 204be61

Please sign in to comment.