From 7166e77c2bc3c623ce990e39413ac8ef50e352f1 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 9 Jan 2024 17:27:54 +0300 Subject: [PATCH] [#895] test: Add logger to test shard Signed-off-by: Dmitrii Stepanov --- pkg/local_object_storage/engine/control_test.go | 2 +- pkg/local_object_storage/engine/engine_test.go | 13 +++++++++---- pkg/local_object_storage/engine/list_test.go | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/local_object_storage/engine/control_test.go b/pkg/local_object_storage/engine/control_test.go index cdaa41a51..0f36f3203 100644 --- a/pkg/local_object_storage/engine/control_test.go +++ b/pkg/local_object_storage/engine/control_test.go @@ -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), diff --git a/pkg/local_object_storage/engine/engine_test.go b/pkg/local_object_storage/engine/engine_test.go index 2b9cdcf84..eb15a9900 100644 --- a/pkg/local_object_storage/engine/engine_test.go +++ b/pkg/local_object_storage/engine/engine_test.go @@ -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)), ), } } diff --git a/pkg/local_object_storage/engine/list_test.go b/pkg/local_object_storage/engine/list_test.go index 186c3e094..7bb1ac0fa 100644 --- a/pkg/local_object_storage/engine/list_test.go +++ b/pkg/local_object_storage/engine/list_test.go @@ -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")),