[#321] shard/test: Parallelize TestWriteCacheObjectLoss

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-05-05 14:07:11 +03:00 committed by Evgenii Stratonikov
parent 969bfb603f
commit d35e4c389f

View file

@ -12,6 +12,7 @@ import (
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"
) )
func TestWriteCacheObjectLoss(t *testing.T) { func TestWriteCacheObjectLoss(t *testing.T) {
@ -39,13 +40,17 @@ func TestWriteCacheObjectLoss(t *testing.T) {
sh := newCustomShard(t, dir, true, wcOpts, nil) sh := newCustomShard(t, dir, true, wcOpts, nil)
var putPrm shard.PutPrm var errG errgroup.Group
for i := range objects { for i := range objects {
putPrm.SetObject(objects[i]) obj := objects[i]
errG.Go(func() error {
var putPrm shard.PutPrm
putPrm.SetObject(obj)
_, err := sh.Put(context.Background(), putPrm) _, err := sh.Put(context.Background(), putPrm)
require.NoError(t, err) return err
})
} }
require.NoError(t, errG.Wait())
require.NoError(t, sh.Close()) require.NoError(t, sh.Close())
sh = newCustomShard(t, dir, true, wcOpts, nil) sh = newCustomShard(t, dir, true, wcOpts, nil)