From d35e4c389f560552f3868573e082be4d99dd3ab5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 5 May 2023 14:07:11 +0300 Subject: [PATCH] [#321] shard/test: Parallelize TestWriteCacheObjectLoss Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/shard/shutdown_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/local_object_storage/shard/shutdown_test.go b/pkg/local_object_storage/shard/shutdown_test.go index 714811b7e..947bd73fd 100644 --- a/pkg/local_object_storage/shard/shutdown_test.go +++ b/pkg/local_object_storage/shard/shutdown_test.go @@ -12,6 +12,7 @@ import ( 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" + "golang.org/x/sync/errgroup" ) func TestWriteCacheObjectLoss(t *testing.T) { @@ -39,13 +40,17 @@ func TestWriteCacheObjectLoss(t *testing.T) { sh := newCustomShard(t, dir, true, wcOpts, nil) - var putPrm shard.PutPrm - + var errG errgroup.Group for i := range objects { - putPrm.SetObject(objects[i]) - _, err := sh.Put(context.Background(), putPrm) - require.NoError(t, err) + obj := objects[i] + errG.Go(func() error { + var putPrm shard.PutPrm + putPrm.SetObject(obj) + _, err := sh.Put(context.Background(), putPrm) + return err + }) } + require.NoError(t, errG.Wait()) require.NoError(t, sh.Close()) sh = newCustomShard(t, dir, true, wcOpts, nil)