diff --git a/pkg/local_object_storage/shard/gc_test.go b/pkg/local_object_storage/shard/gc_test.go index a7daadac..d6a7e39e 100644 --- a/pkg/local_object_storage/shard/gc_test.go +++ b/pkg/local_object_storage/shard/gc_test.go @@ -10,7 +10,6 @@ import ( objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" - writecacheconfig "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache/config" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" @@ -26,10 +25,7 @@ func Test_GCDropsLockedExpiredSimpleObject(t *testing.T) { Value: 100, } - wcOpts := writecacheconfig.Options{ - Type: writecacheconfig.TypeBBolt, - } - sh := newCustomShard(t, false, shardOptions{rootPath: t.TempDir(), wcOpts: wcOpts, metaOptions: []meta.Option{meta.WithEpochState(epoch)}}) + sh := newCustomShard(t, false, shardOptions{metaOptions: []meta.Option{meta.WithEpochState(epoch)}}) t.Cleanup(func() { releaseShard(sh, t) @@ -126,10 +122,7 @@ func Test_GCDropsLockedExpiredComplexObject(t *testing.T) { linkID, _ := link.ID() - wcOpts := writecacheconfig.Options{ - Type: writecacheconfig.TypeBBolt, - } - sh := newCustomShard(t, false, shardOptions{rootPath: t.TempDir(), wcOpts: wcOpts, metaOptions: []meta.Option{meta.WithEpochState(epoch)}}) + sh := newCustomShard(t, false, shardOptions{metaOptions: []meta.Option{meta.WithEpochState(epoch)}}) t.Cleanup(func() { releaseShard(sh, t) diff --git a/pkg/local_object_storage/shard/range_test.go b/pkg/local_object_storage/shard/range_test.go index 8c2f400d..77a20966 100644 --- a/pkg/local_object_storage/shard/range_test.go +++ b/pkg/local_object_storage/shard/range_test.go @@ -77,8 +77,7 @@ func testShardGetRange(t *testing.T, hasWriteCache bool) { } sh := newCustomShard(t, hasWriteCache, shardOptions{ - rootPath: t.TempDir(), - wcOpts: wcOpts, + wcOpts: wcOpts, bsOpts: []blobstor.Option{ blobstor.WithStorages([]blobstor.SubStorage{ { diff --git a/pkg/local_object_storage/shard/shard_test.go b/pkg/local_object_storage/shard/shard_test.go index 1318bd28..33560407 100644 --- a/pkg/local_object_storage/shard/shard_test.go +++ b/pkg/local_object_storage/shard/shard_test.go @@ -38,15 +38,19 @@ type shardOptions struct { } func newShard(t testing.TB, enableWriteCache bool) *Shard { - sh := newCustomShard(t, enableWriteCache, shardOptions{ - rootPath: t.TempDir(), - wcOpts: writecacheconfig.Options{Type: writecacheconfig.TypeBBolt}, - }) + sh := newCustomShard(t, enableWriteCache, shardOptions{}) t.Cleanup(func() { releaseShard(sh, t) }) return sh } func newCustomShard(t testing.TB, enableWriteCache bool, o shardOptions) *Shard { + if o.rootPath == "" { + o.rootPath = t.TempDir() + } + if enableWriteCache && o.wcOpts.Type == 0 { + o.wcOpts.Type = writecacheconfig.TypeBBolt + } + var sh *Shard if enableWriteCache { o.rootPath = filepath.Join(o.rootPath, "wc")