forked from TrueCloudLab/frostfs-node
[#1381] engine: Fix tests
Drop not required `Eventually` calls. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
f71418b73c
commit
0b87be804a
4 changed files with 11 additions and 47 deletions
|
@ -4,11 +4,9 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
||||
"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"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -46,7 +44,7 @@ func testShardHead(t *testing.T, hasWriteCache bool) {
|
|||
|
||||
headPrm.SetAddress(object.AddressOf(obj))
|
||||
|
||||
res, err := testHead(t, sh, headPrm, hasWriteCache)
|
||||
res, err := sh.Head(context.Background(), headPrm)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, obj.CutPayload(), res.Object())
|
||||
})
|
||||
|
@ -74,7 +72,7 @@ func testShardHead(t *testing.T, hasWriteCache bool) {
|
|||
|
||||
var siErr *objectSDK.SplitInfoError
|
||||
|
||||
_, err = testHead(t, sh, headPrm, hasWriteCache)
|
||||
_, err = sh.Head(context.Background(), headPrm)
|
||||
require.True(t, errors.As(err, &siErr))
|
||||
|
||||
headPrm.SetAddress(object.AddressOf(parent))
|
||||
|
@ -85,16 +83,3 @@ func testShardHead(t *testing.T, hasWriteCache bool) {
|
|||
require.Equal(t, parent.CutPayload(), head.Object())
|
||||
})
|
||||
}
|
||||
|
||||
func testHead(t *testing.T, sh *Shard, headPrm HeadPrm, hasWriteCache bool) (HeadRes, error) {
|
||||
res, err := sh.Head(context.Background(), headPrm)
|
||||
if hasWriteCache {
|
||||
require.Eventually(t, func() bool {
|
||||
if client.IsErrObjectNotFound(err) {
|
||||
res, err = sh.Head(context.Background(), headPrm)
|
||||
}
|
||||
return !client.IsErrObjectNotFound(err)
|
||||
}, time.Second, time.Millisecond*100)
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue