[#86] node: Fix unit test and linter errors #163

Merged
fyrchik merged 1 commits from aarifullin/frostfs-node:fix/86-fix_unittests into master 2023-03-23 11:46:17 +00:00
4 changed files with 6 additions and 5 deletions

View File

@ -59,7 +59,7 @@ var _ ObjectGenerator = &SeqObjGenerator{}
func generateObjectWithOIDWithCIDWithSize(oid oid.ID, cid cid.ID, sz uint64) *object.Object {
data := make([]byte, sz)
rand.Read(data)
_, _ = rand.Read(data)
obj := GenerateObjectWithCIDWithPayload(cid, data)
obj.SetID(oid)
return obj

View File

@ -22,7 +22,7 @@ func GenerateObject() *object.Object {
func GenerateObjectWithCID(cnr cid.ID) *object.Object {
data := make([]byte, defaultDataSize)
rand.Read(data)
_, _ = rand.Read(data)
return GenerateObjectWithCIDWithPayload(cnr, data)
}

View File

@ -327,7 +327,7 @@ func TestDumpIgnoreErrors(t *testing.T) {
objects := make([]*objectSDK.Object, objCount)
for i := 0; i < objCount; i++ {
size := (wcSmallObjectSize << (i % 4)) - headerSize
obj := testutil.GenerateObjectWithPayload(cidtest.ID(), make([]byte, size))
obj := testutil.GenerateObjectWithCIDWithPayload(cidtest.ID(), make([]byte, size))
objects[i] = obj
var prm shard.PutPrm

View File

@ -11,6 +11,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobovniczatree"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/fstree"
"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"
@ -83,7 +84,7 @@ func Test_GCDropsLockedExpiredObject(t *testing.T) {
objExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
objExpirationAttr.SetValue("101")
obj := generateObjectWithCID(t, cnr)
obj := testutil.GenerateObjectWithCID(cnr)
obj.SetAttributes(objExpirationAttr)
objID, _ := obj.ID()
@ -91,7 +92,7 @@ func Test_GCDropsLockedExpiredObject(t *testing.T) {
lockExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
lockExpirationAttr.SetValue("103")
lock := generateObjectWithCID(t, cnr)
lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock)
lock.SetAttributes(lockExpirationAttr)
lockID, _ := lock.ID()