From 323dea95c6705c3ceba87545d0f96e6c8fa14ae8 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 5 Mar 2022 11:49:19 +0300 Subject: [PATCH] [#1181] Do not use deprecated elements Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/lock.go | 4 ++-- pkg/local_object_storage/engine/engine_test.go | 4 ++-- pkg/local_object_storage/engine/error_test.go | 4 ++-- pkg/local_object_storage/metabase/get_test.go | 4 ++-- pkg/local_object_storage/metabase/lock_test.go | 2 +- pkg/services/object/acl/v2/util_test.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/neofs-cli/modules/lock.go b/cmd/neofs-cli/modules/lock.go index b6ab40de4..140a991e3 100644 --- a/cmd/neofs-cli/modules/lock.go +++ b/cmd/neofs-cli/modules/lock.go @@ -41,7 +41,7 @@ var cmdObjectLock = &cobra.Command{ var lock object.Lock lock.WriteMembers(lockList) - obj := object.NewRaw() + obj := object.New() obj.SetContainerID(&cnr) obj.SetOwnerID(idOwner) obj.SetType(object.TypeLock) @@ -51,7 +51,7 @@ var cmdObjectLock = &cobra.Command{ prepareSessionPrmWithOwner(cmd, objectcore.AddressOf(obj), key, idOwner, &prm) prepareObjectPrm(cmd, &prm) - prm.SetHeader(obj.Object()) + prm.SetHeader(obj) _, err = internalclient.PutObject(prm) exitOnErr(cmd, errf("Store lock object in NeoFS: %w", err)) diff --git a/pkg/local_object_storage/engine/engine_test.go b/pkg/local_object_storage/engine/engine_test.go index 681f8b344..56144df39 100644 --- a/pkg/local_object_storage/engine/engine_test.go +++ b/pkg/local_object_storage/engine/engine_test.go @@ -57,7 +57,7 @@ func benchmarkExists(b *testing.B, shardNum int) { addr := objecttest.Address() for i := 0; i < 100; i++ { obj := generateObjectWithCID(b, cidtest.ID()) - err := Put(e, obj.Object()) + err := Put(e, obj) if err != nil { b.Fatal(err) } @@ -133,7 +133,7 @@ func testOID() *oidSDK.ID { return id } -func generateObjectWithCID(t testing.TB, cid *cid.ID) *object.RawObject { +func generateObjectWithCID(t testing.TB, cid *cid.ID) *object.Object { version := version.New() version.SetMajor(2) version.SetMinor(1) diff --git a/pkg/local_object_storage/engine/error_test.go b/pkg/local_object_storage/engine/error_test.go index 82ba67f71..7e943e9e0 100644 --- a/pkg/local_object_storage/engine/error_test.go +++ b/pkg/local_object_storage/engine/error_test.go @@ -143,12 +143,12 @@ func TestBlobstorFailback(t *testing.T) { obj := generateObjectWithCID(t, cidtest.ID()) obj.SetPayload(make([]byte, size)) - prm := new(shard.PutPrm).WithObject(obj.Object()) + prm := new(shard.PutPrm).WithObject(obj) e.mtx.RLock() _, err = e.shards[id[0].String()].Shard.Put(prm) e.mtx.RUnlock() require.NoError(t, err) - objs = append(objs, obj.Object()) + objs = append(objs, obj) } for i := range objs { diff --git a/pkg/local_object_storage/metabase/get_test.go b/pkg/local_object_storage/metabase/get_test.go index 5ce8fd5a2..f72ec12b2 100644 --- a/pkg/local_object_storage/metabase/get_test.go +++ b/pkg/local_object_storage/metabase/get_test.go @@ -62,12 +62,12 @@ func TestDB_Get(t *testing.T) { raw.SetType(objectSDK.TypeLock) raw.SetID(testOID()) - err := putBig(db, raw.Object()) + err := putBig(db, raw) require.NoError(t, err) newObj, err := meta.Get(db, object.AddressOf(raw)) require.NoError(t, err) - require.Equal(t, raw.CutPayload().Object(), newObj) + require.Equal(t, raw.CutPayload(), newObj) }) t.Run("put virtual object", func(t *testing.T) { diff --git a/pkg/local_object_storage/metabase/lock_test.go b/pkg/local_object_storage/metabase/lock_test.go index 9ca04b748..8b972784a 100644 --- a/pkg/local_object_storage/metabase/lock_test.go +++ b/pkg/local_object_storage/metabase/lock_test.go @@ -29,7 +29,7 @@ func TestDB_Lock(t *testing.T) { object.TypeLock, object.TypeRegular, } { - obj := objecttest.Raw() + obj := objecttest.Object() obj.SetType(typ) obj.SetContainerID(&cnr) diff --git a/pkg/services/object/acl/v2/util_test.go b/pkg/services/object/acl/v2/util_test.go index 5edb3b9ba..a16aca9f2 100644 --- a/pkg/services/object/acl/v2/util_test.go +++ b/pkg/services/object/acl/v2/util_test.go @@ -24,7 +24,7 @@ func TestOriginalTokens(t *testing.T) { } } -func testGenerateMetaHeader(depth uint32, b *acl.BearerToken, s *session.SessionToken) *session.RequestMetaHeader { +func testGenerateMetaHeader(depth uint32, b *acl.BearerToken, s *session.Token) *session.RequestMetaHeader { metaHeader := new(session.RequestMetaHeader) metaHeader.SetBearerToken(b) metaHeader.SetSessionToken(s)