Skip to content

Commit

Permalink
store-gateway: fix race in TestStreamBinaryReader_CheckSparseHeadersC…
Browse files Browse the repository at this point in the history
…orrectnessExtensive (#5947)

* store-gateway: fix race in TestStreamBinaryReader_CheckSparseHeadersCorrectnessExtensive

This test was using multiple TSDB heads in the same directory, so compaction between each and writing chunks to files would sometimes collide.

Fixes 5943

Signed-off-by: Dimitar Dimitrov <[email protected]>

* Update pkg/storegateway/indexheader/stream_binary_reader_test.go

---------

Signed-off-by: Dimitar Dimitrov <[email protected]>
  • Loading branch information
dimitarvdimitrov authored Sep 6, 2023
1 parent 2c11571 commit 97ec4f0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/storegateway/indexheader/stream_binary_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ func TestStreamBinaryReader_ShouldBuildNotSparseHeadersFromFileSimple(t *testing
func TestStreamBinaryReader_CheckSparseHeadersCorrectnessExtensive(t *testing.T) {
ctx := context.Background()

tmpDir := filepath.Join(t.TempDir(), "test-sparse index headers")
bkt, err := filesystem.NewBucket(filepath.Join(tmpDir, "bkt"))
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, bkt.Close()) })

for _, nameCount := range []int{3, 20, 50} {
for _, valueCount := range []int{3, 10, 100, 500} {

Expand All @@ -99,6 +94,10 @@ func TestStreamBinaryReader_CheckSparseHeadersCorrectnessExtensive(t *testing.T)

t.Run(fmt.Sprintf("%vNames%vValues", nameCount, valueCount), func(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
bkt, err := filesystem.NewBucket(filepath.Join(tmpDir, "bkt"))
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, bkt.Close()) })

blockID, err := block.CreateBlock(ctx, tmpDir, generateLabels(nameSymbols, valueSymbols), 100, 0, 1000, labels.FromStrings("ext1", "1"))
require.NoError(t, err)
Expand Down

0 comments on commit 97ec4f0

Please sign in to comment.