Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: removed unused parameter from GenerateBlockFromSpec() #7303

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestCompactBlocksContainingNativeHistograms(t *testing.T) {
}
expectedSeries[i] = series{lbls: spec.Labels, samples: samples}

meta, err := block.GenerateBlockFromSpec(userID, inDir, []*block.SeriesSpec{&spec})
meta, err := block.GenerateBlockFromSpec(inDir, []*block.SeriesSpec{&spec})
require.NoError(t, err)

require.NoError(t, block.Upload(context.Background(), log.NewNopLogger(), bktClient, filepath.Join(inDir, meta.ULID.String()), meta))
Expand Down
24 changes: 12 additions & 12 deletions pkg/compactor/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1271,11 +1271,11 @@ func TestMultitenantCompactor_ShouldFailWithInvalidTSDBCompactOutput(t *testing.

storageDir := t.TempDir()

meta1, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), sourceBlock1Spec)
meta1, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), sourceBlock1Spec)
require.NoError(t, err)
meta2, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), sourceBlock2Spec)
meta2, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), sourceBlock2Spec)
require.NoError(t, err)
_, err = block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), sourceBlock3Spec)
_, err = block.GenerateBlockFromSpec(filepath.Join(storageDir, user), sourceBlock3Spec)
require.NoError(t, err)

bkt, err := filesystem.NewBucketClient(filesystem.Config{Directory: storageDir})
Expand All @@ -1291,7 +1291,7 @@ func TestMultitenantCompactor_ShouldFailWithInvalidTSDBCompactOutput(t *testing.
mockCall.RunFn = func(args mock.Arguments) {
dir := args.Get(0).(string)

compactedMeta, err := block.GenerateBlockFromSpec(user, dir, compactedBlockSpec)
compactedMeta, err := block.GenerateBlockFromSpec(dir, compactedBlockSpec)
require.NoError(t, err)
f, err := os.OpenFile(filepath.Join(dir, compactedMeta.ULID.String(), "tombstones"), os.O_RDONLY|os.O_CREATE, 0666)
require.NoError(t, err)
Expand Down Expand Up @@ -1460,13 +1460,13 @@ func TestMultitenantCompactor_ShouldSkipCompactionForJobsWithFirstLevelCompactio
}))},
}}

user1Meta1, err := block.GenerateBlockFromSpec("user-1", filepath.Join(storageDir, "user-1"), spec)
user1Meta1, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, "user-1"), spec)
require.NoError(t, err)
user1Meta2, err := block.GenerateBlockFromSpec("user-1", filepath.Join(storageDir, "user-1"), spec)
user1Meta2, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, "user-1"), spec)
require.NoError(t, err)
user2Meta1, err := block.GenerateBlockFromSpec("user-2", filepath.Join(storageDir, "user-2"), spec)
user2Meta1, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, "user-2"), spec)
require.NoError(t, err)
user2Meta2, err := block.GenerateBlockFromSpec("user-2", filepath.Join(storageDir, "user-2"), spec)
user2Meta2, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, "user-2"), spec)
require.NoError(t, err)

// Mock the last modified timestamp returned for each of the block's meta.json.
Expand Down Expand Up @@ -2198,9 +2198,9 @@ func TestMultitenantCompactor_OutOfOrderCompaction(t *testing.T) {

storageDir := t.TempDir()
// We need two blocks to start compaction.
meta1, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), specs)
meta1, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), specs)
require.NoError(t, err)
meta2, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), specs)
meta2, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), specs)
require.NoError(t, err)

bkt, err := filesystem.NewBucketClient(filesystem.Config{Directory: storageDir})
Expand Down Expand Up @@ -2264,9 +2264,9 @@ func TestMultitenantCompactor_CriticalIssue(t *testing.T) {

storageDir := t.TempDir()
// We need two blocks to start compaction.
meta1, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), specs)
meta1, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), specs)
require.NoError(t, err)
meta2, err := block.GenerateBlockFromSpec(user, filepath.Join(storageDir, user), specs)
meta2, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, user), specs)
require.NoError(t, err)

// Force chunk to fall out of the block time range by modifying MaxTime.
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/tsdb/block/block_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (s SeriesSpecs) MaxTime() int64 {

// GenerateBlockFromSpec generates a TSDB block with series and chunks provided by the input specs.
// This utility is intended just to be used for testing. Do not use it for any production code.
func GenerateBlockFromSpec(_ string, storageDir string, specs SeriesSpecs) (_ *Meta, returnErr error) {
func GenerateBlockFromSpec(storageDir string, specs SeriesSpecs) (_ *Meta, returnErr error) {
blockID := ulid.MustNew(ulid.Now(), crypto_rand.Reader)
blockDir := filepath.Join(storageDir, blockID.String())

Expand Down
2 changes: 1 addition & 1 deletion pkg/storegateway/bucket_stores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func TestBucketStore_Series_ShouldQueryBlockWithOutOfOrderChunks(t *testing.T) {
}

storageDir := t.TempDir()
_, err := block.GenerateBlockFromSpec(userID, filepath.Join(storageDir, userID), specs)
_, err := block.GenerateBlockFromSpec(filepath.Join(storageDir, userID), specs)
require.NoError(t, err)

bucket, err := filesystem.NewBucketClient(filesystem.Config{Directory: storageDir})
Expand Down
3 changes: 1 addition & 2 deletions tools/tsdb-chunks/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

func TestTSDBChunks(t *testing.T) {
userID := "user"
tmpDir := t.TempDir()

spec := block.SeriesSpec{
Expand All @@ -37,7 +36,7 @@ func TestTSDBChunks(t *testing.T) {
},
}

meta, err := block.GenerateBlockFromSpec(userID, tmpDir, []*block.SeriesSpec{&spec})
meta, err := block.GenerateBlockFromSpec(tmpDir, []*block.SeriesSpec{&spec})
require.NoError(t, err)

co := test.CaptureOutput(t)
Expand Down
3 changes: 1 addition & 2 deletions tools/tsdb-index-health/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
)

func TestGatherIndexHealthStats(t *testing.T) {
userID := "user"
tmpDir := t.TempDir()

spec1 := block.SeriesSpec{
Expand Down Expand Up @@ -48,7 +47,7 @@ func TestGatherIndexHealthStats(t *testing.T) {
},
}

meta, err := block.GenerateBlockFromSpec(userID, tmpDir, []*block.SeriesSpec{&spec1, &spec2})
meta, err := block.GenerateBlockFromSpec(tmpDir, []*block.SeriesSpec{&spec1, &spec2})
require.NoError(t, err)

blockDir := path.Join(tmpDir, meta.ULID.String())
Expand Down
3 changes: 1 addition & 2 deletions tools/tsdb-print-chunk/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

func TestTSDBPrintChunk(t *testing.T) {
userID := "user"
tmpDir := t.TempDir()

spec := block.SeriesSpec{
Expand All @@ -37,7 +36,7 @@ func TestTSDBPrintChunk(t *testing.T) {
},
}

meta, err := block.GenerateBlockFromSpec(userID, tmpDir, []*block.SeriesSpec{&spec})
meta, err := block.GenerateBlockFromSpec(tmpDir, []*block.SeriesSpec{&spec})
require.NoError(t, err)

blockDir := path.Join(tmpDir, meta.ULID.String())
Expand Down
Loading