forked from TrueCloudLab/frostfs-api-go
Fix unified client tests
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
252b7036c7
commit
ae1c1a351c
4 changed files with 41 additions and 42 deletions
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/accounting"
|
"github.com/nspcc-dev/neofs-api-go/v2/accounting"
|
||||||
accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc"
|
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/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-api-go/v2/signature"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -57,7 +57,7 @@ func testRequest() *accounting.BalanceRequest {
|
||||||
body := new(accounting.BalanceRequestBody)
|
body := new(accounting.BalanceRequestBody)
|
||||||
body.SetOwnerID(ownerID)
|
body.SetOwnerID(ownerID)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(accounting.BalanceRequest)
|
req := new(accounting.BalanceRequest)
|
||||||
|
@ -74,7 +74,7 @@ func testResponse() *accounting.BalanceResponse {
|
||||||
body := new(accounting.BalanceResponseBody)
|
body := new(accounting.BalanceResponseBody)
|
||||||
body.SetBalance(dec)
|
body.SetBalance(dec)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
resp := new(accounting.BalanceResponse)
|
resp := new(accounting.BalanceResponse)
|
||||||
|
@ -136,8 +136,8 @@ func TestGRPCClient(t *testing.T) {
|
||||||
resp := testResponse()
|
resp := testResponse()
|
||||||
|
|
||||||
{ // w/o this require.Equal fails due to nil and []T{} difference
|
{ // w/o this require.Equal fails due to nil and []T{} difference
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
resp.SetMetaHeader(meta)
|
resp.SetMetaHeader(meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/container"
|
"github.com/nspcc-dev/neofs-api-go/v2/container"
|
||||||
containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
|
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/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-api-go/v2/signature"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -183,7 +183,7 @@ func testPutRequest() *container.PutRequest {
|
||||||
body := new(container.PutRequestBody)
|
body := new(container.PutRequestBody)
|
||||||
body.SetContainer(cnr)
|
body.SetContainer(cnr)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.PutRequest)
|
req := new(container.PutRequest)
|
||||||
|
@ -200,9 +200,9 @@ func testPutResponse() *container.PutResponse {
|
||||||
body := new(container.PutResponseBody)
|
body := new(container.PutResponseBody)
|
||||||
body.SetContainerID(cid)
|
body.SetContainerID(cid)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.PutResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -218,7 +218,7 @@ func testGetRequest() *container.GetRequest {
|
||||||
body := new(container.GetRequestBody)
|
body := new(container.GetRequestBody)
|
||||||
body.SetContainerID(cid)
|
body.SetContainerID(cid)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.GetRequest)
|
req := new(container.GetRequest)
|
||||||
|
@ -235,9 +235,9 @@ func testGetResponse() *container.GetResponse {
|
||||||
body := new(container.GetResponseBody)
|
body := new(container.GetResponseBody)
|
||||||
body.SetContainer(cnr)
|
body.SetContainer(cnr)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.GetResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -253,7 +253,7 @@ func testDelRequest() *container.DeleteRequest {
|
||||||
body := new(container.DeleteRequestBody)
|
body := new(container.DeleteRequestBody)
|
||||||
body.SetContainerID(cid)
|
body.SetContainerID(cid)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.DeleteRequest)
|
req := new(container.DeleteRequest)
|
||||||
|
@ -266,9 +266,9 @@ func testDelRequest() *container.DeleteRequest {
|
||||||
func testDelResponse() *container.DeleteResponse {
|
func testDelResponse() *container.DeleteResponse {
|
||||||
body := new(container.DeleteResponseBody)
|
body := new(container.DeleteResponseBody)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.DeleteResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -284,7 +284,7 @@ func testListRequest() *container.ListRequest {
|
||||||
body := new(container.ListRequestBody)
|
body := new(container.ListRequestBody)
|
||||||
body.SetOwnerID(ownerID)
|
body.SetOwnerID(ownerID)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.ListRequest)
|
req := new(container.ListRequest)
|
||||||
|
@ -301,9 +301,9 @@ func testListResponse() *container.ListResponse {
|
||||||
body := new(container.ListResponseBody)
|
body := new(container.ListResponseBody)
|
||||||
body.SetContainerIDs([]*refs.ContainerID{cid})
|
body.SetContainerIDs([]*refs.ContainerID{cid})
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.ListResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -322,7 +322,7 @@ func testSetEACLRequest() *container.SetExtendedACLRequest {
|
||||||
body := new(container.SetExtendedACLRequestBody)
|
body := new(container.SetExtendedACLRequestBody)
|
||||||
body.SetEACL(eacl)
|
body.SetEACL(eacl)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.SetExtendedACLRequest)
|
req := new(container.SetExtendedACLRequest)
|
||||||
|
@ -335,9 +335,9 @@ func testSetEACLRequest() *container.SetExtendedACLRequest {
|
||||||
func testSetEACLResponse() *container.SetExtendedACLResponse {
|
func testSetEACLResponse() *container.SetExtendedACLResponse {
|
||||||
body := new(container.SetExtendedACLResponseBody)
|
body := new(container.SetExtendedACLResponseBody)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.SetExtendedACLResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -353,7 +353,7 @@ func testGetEACLRequest() *container.GetExtendedACLRequest {
|
||||||
body := new(container.GetExtendedACLRequestBody)
|
body := new(container.GetExtendedACLRequestBody)
|
||||||
body.SetContainerID(cid)
|
body.SetContainerID(cid)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(container.GetExtendedACLRequest)
|
req := new(container.GetExtendedACLRequest)
|
||||||
|
@ -374,9 +374,9 @@ func testGetEACLResponse() *container.GetExtendedACLResponse {
|
||||||
body := new(container.GetExtendedACLResponseBody)
|
body := new(container.GetExtendedACLResponseBody)
|
||||||
body.SetEACL(eacl)
|
body.SetEACL(eacl)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
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 := new(container.GetExtendedACLResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
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/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-api-go/v2/signature"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -146,9 +146,9 @@ func testHeadRequest() *object.HeadRequest {
|
||||||
body := new(object.HeadRequestBody)
|
body := new(object.HeadRequestBody)
|
||||||
body.SetAddress(addr)
|
body.SetAddress(addr)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
req := new(object.HeadRequest)
|
req := new(object.HeadRequest)
|
||||||
req.SetBody(body)
|
req.SetBody(body)
|
||||||
|
@ -167,9 +167,9 @@ func testHeadResponse() *object.HeadResponse {
|
||||||
body := new(object.HeadResponseBody)
|
body := new(object.HeadResponseBody)
|
||||||
body.SetHeaderPart(hdrPart)
|
body.SetHeaderPart(hdrPart)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
resp := new(object.HeadResponse)
|
resp := new(object.HeadResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -192,9 +192,9 @@ func testDeleteRequest() *object.DeleteRequest {
|
||||||
body := new(object.DeleteRequestBody)
|
body := new(object.DeleteRequestBody)
|
||||||
body.SetAddress(addr)
|
body.SetAddress(addr)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
req := new(object.DeleteRequest)
|
req := new(object.DeleteRequest)
|
||||||
req.SetBody(body)
|
req.SetBody(body)
|
||||||
|
@ -206,9 +206,9 @@ func testDeleteRequest() *object.DeleteRequest {
|
||||||
func testDeleteResponse() *object.DeleteResponse {
|
func testDeleteResponse() *object.DeleteResponse {
|
||||||
body := new(object.DeleteResponseBody)
|
body := new(object.DeleteResponseBody)
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
resp := new(object.DeleteResponse)
|
resp := new(object.DeleteResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
@ -231,9 +231,9 @@ func testGetRangeHashRequest() *object.GetRangeHashRequest {
|
||||||
body := new(object.GetRangeHashRequestBody)
|
body := new(object.GetRangeHashRequestBody)
|
||||||
body.SetAddress(addr)
|
body.SetAddress(addr)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
req := new(object.GetRangeHashRequest)
|
req := new(object.GetRangeHashRequest)
|
||||||
req.SetBody(body)
|
req.SetBody(body)
|
||||||
|
@ -246,9 +246,9 @@ func testGetRangeHashResponse() *object.GetRangeHashResponse {
|
||||||
body := new(object.GetRangeHashResponseBody)
|
body := new(object.GetRangeHashResponseBody)
|
||||||
body.SetHashList([][]byte{{7, 8, 9}})
|
body.SetHashList([][]byte{{7, 8, 9}})
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
|
|
||||||
resp := new(object.GetRangeHashResponse)
|
resp := new(object.GetRangeHashResponse)
|
||||||
resp.SetBody(body)
|
resp.SetBody(body)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
"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/session"
|
||||||
sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
|
sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/signature"
|
"github.com/nspcc-dev/neofs-api-go/v2/signature"
|
||||||
|
@ -57,7 +56,7 @@ func testRequest() *session.CreateRequest {
|
||||||
body := new(session.CreateRequestBody)
|
body := new(session.CreateRequestBody)
|
||||||
body.SetOwnerID(ownerID)
|
body.SetOwnerID(ownerID)
|
||||||
|
|
||||||
meta := new(service.RequestMetaHeader)
|
meta := new(session.RequestMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
req := new(session.CreateRequest)
|
req := new(session.CreateRequest)
|
||||||
|
@ -71,7 +70,7 @@ func testResponse() *session.CreateResponse {
|
||||||
body := new(session.CreateResponseBody)
|
body := new(session.CreateResponseBody)
|
||||||
body.SetID([]byte{1, 2, 3})
|
body.SetID([]byte{1, 2, 3})
|
||||||
|
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetTTL(1)
|
meta.SetTTL(1)
|
||||||
|
|
||||||
resp := new(session.CreateResponse)
|
resp := new(session.CreateResponse)
|
||||||
|
@ -133,8 +132,8 @@ func TestGRPCClient(t *testing.T) {
|
||||||
resp := testResponse()
|
resp := testResponse()
|
||||||
|
|
||||||
{ // w/o this require.Equal fails due to nil and []T{} difference
|
{ // w/o this require.Equal fails due to nil and []T{} difference
|
||||||
meta := new(service.ResponseMetaHeader)
|
meta := new(session.ResponseMetaHeader)
|
||||||
meta.SetXHeaders([]*service.XHeader{})
|
meta.SetXHeaders([]*session.XHeader{})
|
||||||
resp.SetMetaHeader(meta)
|
resp.SetMetaHeader(meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue