forked from TrueCloudLab/frostfs-node
[#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:
parent
342e571d89
commit
9808dec591
41 changed files with 495 additions and 520 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
|
@ -21,7 +22,7 @@ func TestDB_Containers(t *testing.T) {
|
|||
cids := make(map[string]int, N)
|
||||
|
||||
for i := 0; i < N; i++ {
|
||||
obj := generateObject(t)
|
||||
obj := testutil.GenerateObject()
|
||||
|
||||
cnr, _ := obj.ContainerID()
|
||||
|
||||
|
@ -53,7 +54,7 @@ func TestDB_Containers(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("Inhume", func(t *testing.T) {
|
||||
obj := generateObject(t)
|
||||
obj := testutil.GenerateObject()
|
||||
|
||||
require.NoError(t, putBig(db, obj))
|
||||
|
||||
|
@ -71,7 +72,7 @@ func TestDB_Containers(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("ToMoveIt", func(t *testing.T) {
|
||||
obj := generateObject(t)
|
||||
obj := testutil.GenerateObject()
|
||||
|
||||
require.NoError(t, putBig(db, obj))
|
||||
|
||||
|
@ -107,7 +108,7 @@ func TestDB_ContainersCount(t *testing.T) {
|
|||
|
||||
for _, upload := range uploadObjects {
|
||||
for i := 0; i < upload.amount; i++ {
|
||||
obj := generateObject(t)
|
||||
obj := testutil.GenerateObject()
|
||||
obj.SetType(upload.typ)
|
||||
|
||||
err := putBig(db, obj)
|
||||
|
@ -150,10 +151,10 @@ func TestDB_ContainerSize(t *testing.T) {
|
|||
for j := 0; j < N; j++ {
|
||||
size := rand.Intn(1024)
|
||||
|
||||
parent := generateObjectWithCID(t, cnr)
|
||||
parent := testutil.GenerateObjectWithCID(cnr)
|
||||
parent.SetPayloadSize(uint64(size / 2))
|
||||
|
||||
obj := generateObjectWithCID(t, cnr)
|
||||
obj := testutil.GenerateObjectWithCID(cnr)
|
||||
obj.SetPayloadSize(uint64(size))
|
||||
idParent, _ := parent.ID()
|
||||
obj.SetParentID(idParent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue