Skip to content

Commit b6929d2

Browse files
committed
chunkenc tests: eliminate race in TestSerialization
Avoid changing a global variable. Signed-off-by: Bryan Boreham <[email protected]>
1 parent 4f19ffa commit b6929d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/chunkenc/memchunk_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,15 @@ func TestSerialization(t *testing.T) {
470470
}
471471
require.NoError(t, it.Error())
472472

473-
countExtractor = func() log.StreamSampleExtractor {
473+
extractor := func() log.StreamSampleExtractor {
474474
ex, err := log.NewLineSampleExtractor(log.CountExtractor, nil, nil, false, false)
475475
if err != nil {
476476
panic(err)
477477
}
478478
return ex.ForStream(labels.Labels{})
479479
}()
480480

481-
sampleIt := bc.SampleIterator(context.Background(), time.Unix(0, 0), time.Unix(0, math.MaxInt64), countExtractor)
481+
sampleIt := bc.SampleIterator(context.Background(), time.Unix(0, 0), time.Unix(0, math.MaxInt64), extractor)
482482
for i := 0; i < numSamples; i++ {
483483
require.True(t, sampleIt.Next(), i)
484484

0 commit comments

Comments
 (0)