[#86] node: Fix unit test and linter errors
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/push/pre-commit Pipeline was successful

Signed-off-by: Airat Arifullin <aarifullin@yadro.com>
This commit is contained in:
aarifullin 2023-03-23 12:42:58 +03:00
parent 9808dec591
commit 34329d67ff
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()