From 251d17e36a69612bb74f3817629c38a08539db79 Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Sat, 2 Nov 2024 12:43:19 +0300 Subject: [PATCH] [#1450] engine/test: Refactor `(*testEngineWrapper).setInitializedShards` This function was a duplicate of the `(*StorageEngine).addShard` but it didn't allow to set an engine's shard pool size what can be very useful sometimes. Signed-off-by: Aleksey Savchuk --- pkg/local_object_storage/engine/engine_test.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/pkg/local_object_storage/engine/engine_test.go b/pkg/local_object_storage/engine/engine_test.go index 88c523b76..826e19d9d 100644 --- a/pkg/local_object_storage/engine/engine_test.go +++ b/pkg/local_object_storage/engine/engine_test.go @@ -3,7 +3,6 @@ package engine import ( "context" "path/filepath" - "sync/atomic" "testing" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor" @@ -19,8 +18,6 @@ import ( objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" - "git.frostfs.info/TrueCloudLab/hrw" - "github.com/panjf2000/ants/v2" "github.com/stretchr/testify/require" ) @@ -90,17 +87,7 @@ func testNewEngine(t testing.TB, opts ...Option) *testEngineWrapper { func (te *testEngineWrapper) setInitializedShards(t testing.TB, shards ...*shard.Shard) *testEngineWrapper { for _, s := range shards { - pool, err := ants.NewPool(10, ants.WithNonblocking(true)) - require.NoError(t, err) - - te.engine.shards[s.ID().String()] = hashedShard{ - shardWrapper: shardWrapper{ - errorCount: new(atomic.Uint32), - Shard: s, - }, - hash: hrw.StringHash(s.ID().String()), - } - te.engine.shardPools[s.ID().String()] = pool + require.NoError(t, te.engine.addShard(s)) te.shardIDs = append(te.shardIDs, s.ID()) } return te