diff --git a/pkg/local_object_storage/engine/evacuate_test.go b/pkg/local_object_storage/engine/evacuate_test.go index ca86ef544..d874734d3 100644 --- a/pkg/local_object_storage/engine/evacuate_test.go +++ b/pkg/local_object_storage/engine/evacuate_test.go @@ -83,6 +83,9 @@ func TestEvacuateShard(t *testing.T) { const objPerShard = 3 e, ids, objects := newEngineEvacuate(t, 3, objPerShard) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() evacuateShardID := ids[2].String() @@ -161,6 +164,10 @@ func TestEvacuateNetwork(t *testing.T) { t.Run("single shard", func(t *testing.T) { t.Parallel() e, ids, objects := newEngineEvacuate(t, 1, 3) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() + evacuateShardID := ids[0].String() require.NoError(t, e.shards[evacuateShardID].SetMode(mode.ReadOnly)) @@ -181,6 +188,9 @@ func TestEvacuateNetwork(t *testing.T) { t.Run("multiple shards, evacuate one", func(t *testing.T) { t.Parallel() e, ids, objects := newEngineEvacuate(t, 2, 3) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly)) require.NoError(t, e.shards[ids[1].String()].SetMode(mode.ReadOnly)) @@ -204,6 +214,10 @@ func TestEvacuateNetwork(t *testing.T) { t.Run("multiple shards, evacuate many", func(t *testing.T) { t.Parallel() e, ids, objects := newEngineEvacuate(t, 4, 5) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() + evacuateIDs := ids[0:3] var totalCount uint64 @@ -239,6 +253,9 @@ func TestEvacuateNetwork(t *testing.T) { func TestEvacuateCancellation(t *testing.T) { t.Parallel() e, ids, _ := newEngineEvacuate(t, 2, 3) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly)) require.NoError(t, e.shards[ids[1].String()].SetMode(mode.ReadOnly)) @@ -264,6 +281,9 @@ func TestEvacuateCancellation(t *testing.T) { func TestEvacuateSingleProcess(t *testing.T) { e, ids, _ := newEngineEvacuate(t, 2, 3) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly)) require.NoError(t, e.shards[ids[1].String()].SetMode(mode.ReadOnly)) @@ -303,6 +323,9 @@ func TestEvacuateSingleProcess(t *testing.T) { func TestEvacuateAsync(t *testing.T) { e, ids, _ := newEngineEvacuate(t, 2, 3) + defer func() { + require.NoError(t, e.Close(context.Background())) + }() require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly)) require.NoError(t, e.shards[ids[1].String()].SetMode(mode.ReadOnly)) diff --git a/pkg/local_object_storage/engine/remove_copies_test.go b/pkg/local_object_storage/engine/remove_copies_test.go index 8131fcf0d..dfb2423ff 100644 --- a/pkg/local_object_storage/engine/remove_copies_test.go +++ b/pkg/local_object_storage/engine/remove_copies_test.go @@ -20,6 +20,9 @@ func TestRebalance(t *testing.T) { t.Parallel() te := newEngineWithErrorThreshold(t, "", 0) + defer func() { + require.NoError(t, te.ng.Close(context.Background())) + }() const ( objCount = 20 @@ -106,6 +109,9 @@ func TestRebalanceSingleThread(t *testing.T) { t.Parallel() te := newEngineWithErrorThreshold(t, "", 0) + defer func() { + require.NoError(t, te.ng.Close(context.Background())) + }() obj := testutil.GenerateObjectWithCID(cidtest.ID()) obj.SetPayload(make([]byte, errSmallSize)) @@ -153,6 +159,9 @@ type deleteEvent struct { func TestRebalanceExitByContext(t *testing.T) { te := newEngineWithErrorThreshold(t, "", 0) + defer func() { + require.NoError(t, te.ng.Close(context.Background())) + }() objects := make([]*objectSDK.Object, 4) for i := range objects { diff --git a/pkg/local_object_storage/engine/tree_test.go b/pkg/local_object_storage/engine/tree_test.go index f1650b5ae..2739058e9 100644 --- a/pkg/local_object_storage/engine/tree_test.go +++ b/pkg/local_object_storage/engine/tree_test.go @@ -9,6 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "github.com/stretchr/testify/require" ) func BenchmarkTreeVsSearch(b *testing.B) { @@ -25,6 +26,10 @@ func BenchmarkTreeVsSearch(b *testing.B) { func benchmarkTreeVsSearch(b *testing.B, objCount int) { te := newEngineWithErrorThreshold(b, "", 0) + defer func() { + require.NoError(b, te.ng.Close(context.Background())) + }() + cid := cidtest.ID() d := pilorama.CIDDescriptor{CID: cid, Position: 0, Size: 1} treeID := "someTree"