From ae1c1a351cb63f9daed8540568255e925e54454e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:49:49 +0300 Subject: [PATCH] Fix unified client tests Signed-off-by: Alex Vanin --- v2/accounting/test/client_test.go | 10 ++++---- v2/container/test/client_test.go | 38 +++++++++++++++---------------- v2/object/test/client_test.go | 26 ++++++++++----------- v2/session/test/client_test.go | 9 ++++---- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/v2/accounting/test/client_test.go b/v2/accounting/test/client_test.go index 686137f0..58175728 100644 --- a/v2/accounting/test/client_test.go +++ b/v2/accounting/test/client_test.go @@ -9,7 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/accounting" accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -57,7 +57,7 @@ func testRequest() *accounting.BalanceRequest { body := new(accounting.BalanceRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(accounting.BalanceRequest) @@ -74,7 +74,7 @@ func testResponse() *accounting.BalanceResponse { body := new(accounting.BalanceResponseBody) body.SetBalance(dec) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) resp := new(accounting.BalanceResponse) @@ -136,8 +136,8 @@ func TestGRPCClient(t *testing.T) { resp := testResponse() { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(service.ResponseMetaHeader) - meta.SetXHeaders([]*service.XHeader{}) + meta := new(session.ResponseMetaHeader) + meta.SetXHeaders([]*session.XHeader{}) resp.SetMetaHeader(meta) } diff --git a/v2/container/test/client_test.go b/v2/container/test/client_test.go index b22ed3e7..efa2361d 100644 --- a/v2/container/test/client_test.go +++ b/v2/container/test/client_test.go @@ -10,7 +10,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -183,7 +183,7 @@ func testPutRequest() *container.PutRequest { body := new(container.PutRequestBody) body.SetContainer(cnr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.PutRequest) @@ -200,9 +200,9 @@ func testPutResponse() *container.PutResponse { body := new(container.PutResponseBody) body.SetContainerID(cid) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.PutResponse) resp.SetBody(body) @@ -218,7 +218,7 @@ func testGetRequest() *container.GetRequest { body := new(container.GetRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.GetRequest) @@ -235,9 +235,9 @@ func testGetResponse() *container.GetResponse { body := new(container.GetResponseBody) body.SetContainer(cnr) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.GetResponse) resp.SetBody(body) @@ -253,7 +253,7 @@ func testDelRequest() *container.DeleteRequest { body := new(container.DeleteRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.DeleteRequest) @@ -266,9 +266,9 @@ func testDelRequest() *container.DeleteRequest { func testDelResponse() *container.DeleteResponse { body := new(container.DeleteResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.DeleteResponse) resp.SetBody(body) @@ -284,7 +284,7 @@ func testListRequest() *container.ListRequest { body := new(container.ListRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.ListRequest) @@ -301,9 +301,9 @@ func testListResponse() *container.ListResponse { body := new(container.ListResponseBody) body.SetContainerIDs([]*refs.ContainerID{cid}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.ListResponse) resp.SetBody(body) @@ -322,7 +322,7 @@ func testSetEACLRequest() *container.SetExtendedACLRequest { body := new(container.SetExtendedACLRequestBody) body.SetEACL(eacl) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.SetExtendedACLRequest) @@ -335,9 +335,9 @@ func testSetEACLRequest() *container.SetExtendedACLRequest { func testSetEACLResponse() *container.SetExtendedACLResponse { body := new(container.SetExtendedACLResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.SetExtendedACLResponse) resp.SetBody(body) @@ -353,7 +353,7 @@ func testGetEACLRequest() *container.GetExtendedACLRequest { body := new(container.GetExtendedACLRequestBody) body.SetContainerID(cid) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(container.GetExtendedACLRequest) @@ -374,9 +374,9 @@ func testGetEACLResponse() *container.GetExtendedACLResponse { body := new(container.GetExtendedACLResponseBody) body.SetEACL(eacl) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference + meta.SetXHeaders([]*session.XHeader{}) // w/o this require.Equal fails due to nil and []T{} difference resp := new(container.GetExtendedACLResponse) resp.SetBody(body) diff --git a/v2/object/test/client_test.go b/v2/object/test/client_test.go index 87eb9206..0acb15f2 100644 --- a/v2/object/test/client_test.go +++ b/v2/object/test/client_test.go @@ -9,7 +9,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" + "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" "github.com/nspcc-dev/neofs-crypto/test" "github.com/stretchr/testify/require" @@ -146,9 +146,9 @@ func testHeadRequest() *object.HeadRequest { body := new(object.HeadRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.HeadRequest) req.SetBody(body) @@ -167,9 +167,9 @@ func testHeadResponse() *object.HeadResponse { body := new(object.HeadResponseBody) body.SetHeaderPart(hdrPart) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.HeadResponse) resp.SetBody(body) @@ -192,9 +192,9 @@ func testDeleteRequest() *object.DeleteRequest { body := new(object.DeleteRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.DeleteRequest) req.SetBody(body) @@ -206,9 +206,9 @@ func testDeleteRequest() *object.DeleteRequest { func testDeleteResponse() *object.DeleteResponse { body := new(object.DeleteResponseBody) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.DeleteResponse) resp.SetBody(body) @@ -231,9 +231,9 @@ func testGetRangeHashRequest() *object.GetRangeHashRequest { body := new(object.GetRangeHashRequestBody) body.SetAddress(addr) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) req := new(object.GetRangeHashRequest) req.SetBody(body) @@ -246,9 +246,9 @@ func testGetRangeHashResponse() *object.GetRangeHashResponse { body := new(object.GetRangeHashResponseBody) body.SetHashList([][]byte{{7, 8, 9}}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) - meta.SetXHeaders([]*service.XHeader{}) + meta.SetXHeaders([]*session.XHeader{}) resp := new(object.GetRangeHashResponse) resp.SetBody(body) diff --git a/v2/session/test/client_test.go b/v2/session/test/client_test.go index 156bc8e8..cc017995 100644 --- a/v2/session/test/client_test.go +++ b/v2/session/test/client_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/nspcc-dev/neofs-api-go/v2/refs" - "github.com/nspcc-dev/neofs-api-go/v2/service" "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" "github.com/nspcc-dev/neofs-api-go/v2/signature" @@ -57,7 +56,7 @@ func testRequest() *session.CreateRequest { body := new(session.CreateRequestBody) body.SetOwnerID(ownerID) - meta := new(service.RequestMetaHeader) + meta := new(session.RequestMetaHeader) meta.SetTTL(1) req := new(session.CreateRequest) @@ -71,7 +70,7 @@ func testResponse() *session.CreateResponse { body := new(session.CreateResponseBody) body.SetID([]byte{1, 2, 3}) - meta := new(service.ResponseMetaHeader) + meta := new(session.ResponseMetaHeader) meta.SetTTL(1) resp := new(session.CreateResponse) @@ -133,8 +132,8 @@ func TestGRPCClient(t *testing.T) { resp := testResponse() { // w/o this require.Equal fails due to nil and []T{} difference - meta := new(service.ResponseMetaHeader) - meta.SetXHeaders([]*service.XHeader{}) + meta := new(session.ResponseMetaHeader) + meta.SetXHeaders([]*session.XHeader{}) resp.SetMetaHeader(meta) }