From 34329d67ff9daca21cc6e566a7d6cb7e093b45df Mon Sep 17 00:00:00 2001 From: aarifullin Date: Thu, 23 Mar 2023 12:42:58 +0300 Subject: [PATCH] [#86] node: Fix unit test and linter errors Signed-off-by: Airat Arifullin --- pkg/local_object_storage/internal/testutil/generators.go | 2 +- pkg/local_object_storage/internal/testutil/object.go | 2 +- pkg/local_object_storage/shard/dump_test.go | 2 +- pkg/local_object_storage/shard/gc_test.go | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/local_object_storage/internal/testutil/generators.go b/pkg/local_object_storage/internal/testutil/generators.go index 65b2d990..9b493753 100644 --- a/pkg/local_object_storage/internal/testutil/generators.go +++ b/pkg/local_object_storage/internal/testutil/generators.go @@ -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 diff --git a/pkg/local_object_storage/internal/testutil/object.go b/pkg/local_object_storage/internal/testutil/object.go index 7ef5e0b7..4f6d9581 100644 --- a/pkg/local_object_storage/internal/testutil/object.go +++ b/pkg/local_object_storage/internal/testutil/object.go @@ -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) } diff --git a/pkg/local_object_storage/shard/dump_test.go b/pkg/local_object_storage/shard/dump_test.go index 9ca82a7a..65427dd5 100644 --- a/pkg/local_object_storage/shard/dump_test.go +++ b/pkg/local_object_storage/shard/dump_test.go @@ -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 diff --git a/pkg/local_object_storage/shard/gc_test.go b/pkg/local_object_storage/shard/gc_test.go index 8643605e..1e266f51 100644 --- a/pkg/local_object_storage/shard/gc_test.go +++ b/pkg/local_object_storage/shard/gc_test.go @@ -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() -- 2.40.1