[#895] test: Add logger to test shard

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
fix/get_range_hash_permissions
Dmitrii Stepanov 2024-01-09 17:27:54 +03:00 committed by Evgenii Stratonikov
parent 47dcfa20f3
commit 7166e77c2b
3 changed files with 11 additions and 6 deletions

View File

@ -298,7 +298,7 @@ func engineWithShards(t *testing.T, path string, num int) (*StorageEngine, []str
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages(newStorages(filepath.Join(addPath, strconv.Itoa(id)), errSmallSize))), blobstor.WithStorages(newStorages(t, filepath.Join(addPath, strconv.Itoa(id)), errSmallSize))),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
meta.WithPath(filepath.Join(addPath, fmt.Sprintf("%d.metabase", id))), meta.WithPath(filepath.Join(addPath, fmt.Sprintf("%d.metabase", id))),
meta.WithPermissions(0o700), meta.WithPermissions(0o700),

View File

@ -133,14 +133,15 @@ func (te *testEngineWrapper) setShardsNumAdditionalOpts(t testing.TB, num int, s
return te return te
} }
func newStorages(root string, smallSize uint64) []blobstor.SubStorage { func newStorages(t testing.TB, root string, smallSize uint64) []blobstor.SubStorage {
return []blobstor.SubStorage{ return []blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithRootPath(filepath.Join(root, "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(root, "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1), blobovniczatree.WithBlobovniczaShallowWidth(1),
blobovniczatree.WithPermissions(0o700)), blobovniczatree.WithPermissions(0o700),
blobovniczatree.WithLogger(test.NewLogger(t))),
Policy: func(_ *objectSDK.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return uint64(len(data)) < smallSize return uint64(len(data)) < smallSize
}, },
@ -148,7 +149,8 @@ func newStorages(root string, smallSize uint64) []blobstor.SubStorage {
{ {
Storage: fstree.New( Storage: fstree.New(
fstree.WithPath(root), fstree.WithPath(root),
fstree.WithDepth(1)), fstree.WithDepth(1),
fstree.WithLogger(test.NewLogger(t))),
}, },
} }
} }
@ -197,12 +199,15 @@ func testDefaultShardOptions(t testing.TB, id int) []shard.Option {
shard.WithLogger(test.NewLogger(t)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages( blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))), newStorages(t, t.TempDir(), 1<<20)),
blobstor.WithLogger(test.NewLogger(t)),
),
shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama"))), shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama"))),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
meta.WithPath(filepath.Join(t.TempDir(), "metabase")), meta.WithPath(filepath.Join(t.TempDir(), "metabase")),
meta.WithPermissions(0o700), meta.WithPermissions(0o700),
meta.WithEpochState(epochState{}), meta.WithEpochState(epochState{}),
meta.WithLogger(test.NewLogger(t)),
), ),
} }
} }

View File

@ -68,7 +68,7 @@ func TestListWithCursor(t *testing.T) {
shard.WithLogger(test.NewLogger(t)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages( blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))), newStorages(t, t.TempDir(), 1<<20))),
shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama"))), shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama"))),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
meta.WithPath(filepath.Join(t.TempDir(), "metabase")), meta.WithPath(filepath.Join(t.TempDir(), "metabase")),