[#86] node: Move testing utils to one package

Move testing utils from tests in local_object_storage package to
unified testutil package

Signed-off-by: Airat Arifullin <aarifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2023-03-20 17:10:26 +03:00 committed by Gitea
parent 342e571d89
commit 9808dec591
41 changed files with 495 additions and 520 deletions

View file

@ -9,6 +9,7 @@ import (
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
@ -41,7 +42,7 @@ func TestLockUserScenario(t *testing.T) {
const lockerExpiresAfter = 13
cnr := cidtest.ID()
tombObj := generateObjectWithCID(t, cnr)
tombObj := testutil.GenerateObjectWithCID(cnr)
tombForLockID := oidtest.ID()
tombObj.SetID(tombForLockID)
@ -79,7 +80,7 @@ func TestLockUserScenario(t *testing.T) {
a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.Itoa(lockerExpiresAfter))
lockerObj := generateObjectWithCID(t, cnr)
lockerObj := testutil.GenerateObjectWithCID(cnr)
lockerObj.SetID(lockerID)
lockerObj.SetAttributes(a)
@ -88,7 +89,7 @@ func TestLockUserScenario(t *testing.T) {
tombForLockAddr.SetObject(tombForLockID)
// 1.
obj := generateObjectWithCID(t, cnr)
obj := testutil.GenerateObjectWithCID(cnr)
id, _ := obj.ID()
objAddr.SetObject(id)
@ -166,7 +167,7 @@ func TestLockExpiration(t *testing.T) {
var err error
// 1.
obj := generateObjectWithCID(t, cnr)
obj := testutil.GenerateObjectWithCID(cnr)
err = Put(e, obj)
require.NoError(t, err)
@ -176,7 +177,7 @@ func TestLockExpiration(t *testing.T) {
a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.Itoa(lockerExpiresAfter))
lock := generateObjectWithCID(t, cnr)
lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock)
lock.SetAttributes(a)
@ -237,13 +238,13 @@ func TestLockForceRemoval(t *testing.T) {
var err error
// 1.
obj := generateObjectWithCID(t, cnr)
obj := testutil.GenerateObjectWithCID(cnr)
err = Put(e, obj)
require.NoError(t, err)
// 2.
lock := generateObjectWithCID(t, cnr)
lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock)
err = Put(e, lock)