[#895] test: Add logger to test shard
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
47dcfa20f3
commit
7166e77c2b
3 changed files with 11 additions and 6 deletions
|
@ -298,7 +298,7 @@ func engineWithShards(t *testing.T, path string, num int) (*StorageEngine, []str
|
|||
return []shard.Option{
|
||||
shard.WithLogger(test.NewLogger(t)),
|
||||
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(
|
||||
meta.WithPath(filepath.Join(addPath, fmt.Sprintf("%d.metabase", id))),
|
||||
meta.WithPermissions(0o700),
|
||||
|
|
|
@ -133,14 +133,15 @@ func (te *testEngineWrapper) setShardsNumAdditionalOpts(t testing.TB, num int, s
|
|||
return te
|
||||
}
|
||||
|
||||
func newStorages(root string, smallSize uint64) []blobstor.SubStorage {
|
||||
func newStorages(t testing.TB, root string, smallSize uint64) []blobstor.SubStorage {
|
||||
return []blobstor.SubStorage{
|
||||
{
|
||||
Storage: blobovniczatree.NewBlobovniczaTree(
|
||||
blobovniczatree.WithRootPath(filepath.Join(root, "blobovnicza")),
|
||||
blobovniczatree.WithBlobovniczaShallowDepth(1),
|
||||
blobovniczatree.WithBlobovniczaShallowWidth(1),
|
||||
blobovniczatree.WithPermissions(0o700)),
|
||||
blobovniczatree.WithPermissions(0o700),
|
||||
blobovniczatree.WithLogger(test.NewLogger(t))),
|
||||
Policy: func(_ *objectSDK.Object, data []byte) bool {
|
||||
return uint64(len(data)) < smallSize
|
||||
},
|
||||
|
@ -148,7 +149,8 @@ func newStorages(root string, smallSize uint64) []blobstor.SubStorage {
|
|||
{
|
||||
Storage: fstree.New(
|
||||
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.WithBlobStorOptions(
|
||||
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.WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(t.TempDir(), "metabase")),
|
||||
meta.WithPermissions(0o700),
|
||||
meta.WithEpochState(epochState{}),
|
||||
meta.WithLogger(test.NewLogger(t)),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestListWithCursor(t *testing.T) {
|
|||
shard.WithLogger(test.NewLogger(t)),
|
||||
shard.WithBlobStorOptions(
|
||||
blobstor.WithStorages(
|
||||
newStorages(t.TempDir(), 1<<20))),
|
||||
newStorages(t, t.TempDir(), 1<<20))),
|
||||
shard.WithPiloramaOptions(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama"))),
|
||||
shard.WithMetaBaseOptions(
|
||||
meta.WithPath(filepath.Join(t.TempDir(), "metabase")),
|
||||
|
|
Loading…
Reference in a new issue