From aa6a4950d595ec8cbb9477a006076ab52ce2f26b Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 25 Mar 2022 11:34:09 +0300 Subject: [PATCH] [#85] pool: fix skipped tests Signed-off-by: Denis Kirillov --- pool/mock_test.go | 327 ++++++++++++++++++++----------------------- pool/pool_test.go | 193 ++++++++++++++----------- pool/sampler_test.go | 8 +- 3 files changed, 270 insertions(+), 258 deletions(-) diff --git a/pool/mock_test.go b/pool/mock_test.go index 592b9a1..9572f6b 100644 --- a/pool/mock_test.go +++ b/pool/mock_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/nspcc-dev/neofs-sdk-go/Pool (interfaces: client) +// Source: github.com/nspcc-dev/neofs-sdk-go/pool (interfaces: Client) // Package pool is a generated GoMock package. package pool @@ -9,10 +9,16 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - client0 "github.com/nspcc-dev/neofs-sdk-go/client" + accounting "github.com/nspcc-dev/neofs-sdk-go/accounting" + container "github.com/nspcc-dev/neofs-sdk-go/container" + id "github.com/nspcc-dev/neofs-sdk-go/container/id" + eacl "github.com/nspcc-dev/neofs-sdk-go/eacl" + netmap "github.com/nspcc-dev/neofs-sdk-go/netmap" + object "github.com/nspcc-dev/neofs-sdk-go/object" + id0 "github.com/nspcc-dev/neofs-sdk-go/object/id" ) -// MockClient is a mock of client interface. +// MockClient is a mock of Client interface. type MockClient struct { ctrl *gomock.Controller recorder *MockClientMockRecorder @@ -35,79 +41,114 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder { return m.recorder } -// CreateSession mocks base method. -func (m *MockClient) SessionCreate(arg0 context.Context, arg1 client0.PrmSessionCreate) (*client0.ResSessionCreate, error) { +// BalanceGet mocks base method. +func (m *MockClient) BalanceGet(arg0 context.Context, arg1 PrmBalanceGet) (*accounting.Decimal, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "SessionCreate", varargs...) - ret0, _ := ret[0].(*client0.ResSessionCreate) + ret := m.ctrl.Call(m, "BalanceGet", arg0, arg1) + ret0, _ := ret[0].(*accounting.Decimal) ret1, _ := ret[1].(error) return ret0, ret1 } -// CreateSession indicates an expected call of CreateSession. -func (mr *MockClientMockRecorder) CreateSession(arg0, arg1 interface{}) *gomock.Call { +// BalanceGet indicates an expected call of BalanceGet. +func (mr *MockClientMockRecorder) BalanceGet(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SessionCreate", reflect.TypeOf((*MockClient)(nil).SessionCreate), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BalanceGet", reflect.TypeOf((*MockClient)(nil).BalanceGet), arg0, arg1) } -// DeleteContainer mocks base method. -func (m *MockClient) ContainerDelete(arg0 context.Context, arg1 client0.PrmContainerDelete) (*client0.ResContainerDelete, error) { +// ContainerDelete mocks base method. +func (m *MockClient) ContainerDelete(arg0 context.Context, arg1 PrmContainerDelete) error { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerDelete", varargs...) - ret0, _ := ret[0].(*client0.ResContainerDelete) + ret := m.ctrl.Call(m, "ContainerDelete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerDelete indicates an expected call of ContainerDelete. +func (mr *MockClientMockRecorder) ContainerDelete(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDelete", reflect.TypeOf((*MockClient)(nil).ContainerDelete), arg0, arg1) +} + +// ContainerEACL mocks base method. +func (m *MockClient) ContainerEACL(arg0 context.Context, arg1 PrmContainerEACL) (*eacl.Table, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerEACL", arg0, arg1) + ret0, _ := ret[0].(*eacl.Table) ret1, _ := ret[1].(error) return ret0, ret1 } -// DeleteContainer indicates an expected call of DeleteContainer. -func (mr *MockClientMockRecorder) DeleteContainer(arg0, arg1 interface{}) *gomock.Call { +// ContainerEACL indicates an expected call of ContainerEACL. +func (mr *MockClientMockRecorder) ContainerEACL(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDelete", reflect.TypeOf((*MockClient)(nil).ContainerDelete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerEACL", reflect.TypeOf((*MockClient)(nil).ContainerEACL), arg0, arg1) } -// ObjectDelete mocks base method. -func (m *MockClient) ObjectDelete(arg0 context.Context, arg1 client0.PrmObjectDelete) (*client0.ResObjectDelete, error) { +// ContainerGet mocks base method. +func (m *MockClient) ContainerGet(arg0 context.Context, arg1 PrmContainerGet) (*container.Container, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ObjectDelete", arg0, arg1) - ret0, _ := ret[0].(*client0.ResObjectDelete) + ret := m.ctrl.Call(m, "ContainerGet", arg0, arg1) + ret0, _ := ret[0].(*container.Container) ret1, _ := ret[1].(error) return ret0, ret1 } -// DeleteObject indicates an expected call of DeleteObject. -func (mr *MockClientMockRecorder) DeleteObject(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +// ContainerGet indicates an expected call of ContainerGet. +func (mr *MockClientMockRecorder) ContainerGet(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockClient)(nil).ObjectDelete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerGet", reflect.TypeOf((*MockClient)(nil).ContainerGet), arg0, arg1) } -// EACL mocks base method. -func (m *MockClient) ContainerEACL(arg0 context.Context, arg1 client0.PrmContainerEACL) (*client0.ResContainerEACL, error) { +// ContainerList mocks base method. +func (m *MockClient) ContainerList(arg0 context.Context, arg1 PrmContainerList) ([]id.ID, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerEACL", varargs...) - ret0, _ := ret[0].(*client0.ResContainerEACL) + ret := m.ctrl.Call(m, "ContainerList", arg0, arg1) + ret0, _ := ret[0].([]id.ID) ret1, _ := ret[1].(error) return ret0, ret1 } -// EACL indicates an expected call of EACL. -func (mr *MockClientMockRecorder) EACL(arg0, arg1 interface{}) *gomock.Call { +// ContainerList indicates an expected call of ContainerList. +func (mr *MockClientMockRecorder) ContainerList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerEACL", reflect.TypeOf((*MockClient)(nil).ContainerEACL), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerList", reflect.TypeOf((*MockClient)(nil).ContainerList), arg0, arg1) +} + +// ContainerPut mocks base method. +func (m *MockClient) ContainerPut(arg0 context.Context, arg1 PrmContainerPut) (*id.ID, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerPut", arg0, arg1) + ret0, _ := ret[0].(*id.ID) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerPut indicates an expected call of ContainerPut. +func (mr *MockClientMockRecorder) ContainerPut(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerPut", reflect.TypeOf((*MockClient)(nil).ContainerPut), arg0, arg1) +} + +// ContainerSetEACL mocks base method. +func (m *MockClient) ContainerSetEACL(arg0 context.Context, arg1 PrmContainerSetEACL) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerSetEACL", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerSetEACL indicates an expected call of ContainerSetEACL. +func (mr *MockClientMockRecorder) ContainerSetEACL(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSetEACL", reflect.TypeOf((*MockClient)(nil).ContainerSetEACL), arg0, arg1) } // EndpointInfo mocks base method. -func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 client0.PrmEndpointInfo) (*client0.ResEndpointInfo, error) { +func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 PrmEndpointInfo) (*netmap.NodeInfo, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "EndpointInfo", varargs...) - ret0, _ := ret[0].(*client0.ResEndpointInfo) + ret := m.ctrl.Call(m, "EndpointInfo", arg0, arg1) + ret0, _ := ret[0].(*netmap.NodeInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -115,99 +156,14 @@ func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 client0.PrmEndpoint // EndpointInfo indicates an expected call of EndpointInfo. func (mr *MockClientMockRecorder) EndpointInfo(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndpointInfo", reflect.TypeOf((*MockClient)(nil).EndpointInfo), varargs...) -} - -// GetBalance mocks base method. -func (m *MockClient) BalanceGet(arg0 context.Context, arg1 client0.PrmBalanceGet) (*client0.ResBalanceGet, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "BalanceGet", varargs...) - ret0, _ := ret[0].(*client0.ResBalanceGet) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBalance indicates an expected call of GetBalance. -func (mr *MockClientMockRecorder) GetBalance(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BalanceGet", reflect.TypeOf((*MockClient)(nil).BalanceGet), varargs...) -} - -// GetContainer mocks base method. -func (m *MockClient) ContainerGet(arg0 context.Context, arg1 client0.PrmContainerGet) (*client0.ResContainerGet, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerGet", varargs...) - ret0, _ := ret[0].(*client0.ResContainerGet) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetContainer indicates an expected call of GetContainer. -func (mr *MockClientMockRecorder) GetContainer(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerGet", reflect.TypeOf((*MockClient)(nil).ContainerGet), varargs...) -} - -// ObjectGetInitmocks base method. -func (m *MockClient) ObjectGetInit(arg0 context.Context, arg1 client0.PrmObjectGet) (*client0.ObjectReader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetObject", arg0, arg1) - ret0, _ := ret[0].(*client0.ObjectReader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetObject indicates an expected call of GetObject. -func (mr *MockClientMockRecorder) GetObject(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectGetInit", reflect.TypeOf((*MockClient)(nil).ObjectGetInit), varargs...) -} - -// ObjectHead mocks base method. -func (m *MockClient) ObjectHead(arg0 context.Context, arg1 client0.PrmObjectHead) (*client0.ResObjectHead, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HeadObject", arg0, arg1) - ret0, _ := ret[0].(*client0.ResObjectHead) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HeadObject indicates an expected call of HeadObject. -func (mr *MockClientMockRecorder) HeadObject(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeadObject", reflect.TypeOf((*MockClient)(nil).ObjectHead), varargs...) -} - -// ListContainers mocks base method. -func (m *MockClient) ContainerList(arg0 context.Context, arg1 client0.PrmContainerList) (*client0.ResContainerList, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerList", varargs...) - ret0, _ := ret[0].(*client0.ResContainerList) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListContainers indicates an expected call of ListContainers. -func (mr *MockClientMockRecorder) ListContainers(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerList", reflect.TypeOf((*MockClient)(nil).ContainerList), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndpointInfo", reflect.TypeOf((*MockClient)(nil).EndpointInfo), arg0, arg1) } // NetworkInfo mocks base method. -func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 client0.PrmNetworkInfo) (*client0.ResNetworkInfo, error) { +func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 PrmNetworkInfo) (*netmap.NetworkInfo, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "NetworkInfo", varargs...) - ret0, _ := ret[0].(*client0.ResNetworkInfo) + ret := m.ctrl.Call(m, "NetworkInfo", arg0, arg1) + ret0, _ := ret[0].(*netmap.NetworkInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -215,88 +171,109 @@ func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 client0.PrmNetworkIn // NetworkInfo indicates an expected call of NetworkInfo. func (mr *MockClientMockRecorder) NetworkInfo(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInfo", reflect.TypeOf((*MockClient)(nil).NetworkInfo), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInfo", reflect.TypeOf((*MockClient)(nil).NetworkInfo), arg0, arg1) } -// ObjectRangeInit mocks base method. -func (m *MockClient) ObjectRangeInit(arg0 context.Context, arg1 client0.PrmObjectRange) (*client0.ObjectRangeReader, error) { +// ObjectDelete mocks base method. +func (m *MockClient) ObjectDelete(arg0 context.Context, arg1 PrmObjectDelete) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ObjectRangeInit", arg0, arg1) - ret0, _ := ret[0].(*client0.ObjectRangeReader) + ret := m.ctrl.Call(m, "ObjectDelete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ObjectDelete indicates an expected call of ObjectDelete. +func (mr *MockClientMockRecorder) ObjectDelete(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectDelete", reflect.TypeOf((*MockClient)(nil).ObjectDelete), arg0, arg1) +} + +// ObjectGet mocks base method. +func (m *MockClient) ObjectGet(arg0 context.Context, arg1 PrmObjectGet) (*ResGetObject, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ObjectGet", arg0, arg1) + ret0, _ := ret[0].(*ResGetObject) ret1, _ := ret[1].(error) return ret0, ret1 } -// ObjectRange indicates an expected call of ObjectRangeInit. -func (mr *MockClientMockRecorder) ObjectRange(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +// ObjectGet indicates an expected call of ObjectGet. +func (mr *MockClientMockRecorder) ObjectGet(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectRangeInit", reflect.TypeOf((*MockClient)(nil).ObjectRangeInit), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectGet", reflect.TypeOf((*MockClient)(nil).ObjectGet), arg0, arg1) } -// PutContainer mocks base method. -func (m *MockClient) ContainerPut(arg0 context.Context, arg1 client0.PrmContainerPut) (*client0.ResContainerPut, error) { +// ObjectHead mocks base method. +func (m *MockClient) ObjectHead(arg0 context.Context, arg1 PrmObjectHead) (*object.Object, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerPut", varargs...) - ret0, _ := ret[0].(*client0.ResContainerPut) + ret := m.ctrl.Call(m, "ObjectHead", arg0, arg1) + ret0, _ := ret[0].(*object.Object) ret1, _ := ret[1].(error) return ret0, ret1 } -// PutContainer indicates an expected call of PutContainer. -func (mr *MockClientMockRecorder) PutContainer(arg0, arg1 interface{}) *gomock.Call { +// ObjectHead indicates an expected call of ObjectHead. +func (mr *MockClientMockRecorder) ObjectHead(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerPut", reflect.TypeOf((*MockClient)(nil).ContainerPut), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectHead", reflect.TypeOf((*MockClient)(nil).ObjectHead), arg0, arg1) } -// ObjectPutInitmocks base method. -func (m *MockClient) ObjectPutInit(arg0 context.Context, arg1 client0.PrmObjectPutInit) (*client0.ObjectWriter, error) { +// ObjectPut mocks base method. +func (m *MockClient) ObjectPut(arg0 context.Context, arg1 PrmObjectPut) (*id0.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PutObject", arg0) - ret0, _ := ret[0].(*client0.ObjectWriter) + ret := m.ctrl.Call(m, "ObjectPut", arg0, arg1) + ret0, _ := ret[0].(*id0.ID) ret1, _ := ret[1].(error) return ret0, ret1 } -// PutObject indicates an expected call of PutObject. -func (mr *MockClientMockRecorder) PutObject(arg0, arg1 interface{}) *gomock.Call { +// ObjectPut indicates an expected call of ObjectPut. +func (mr *MockClientMockRecorder) ObjectPut(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectPutInit", reflect.TypeOf((*MockClient)(nil).ObjectPutInit), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectPut", reflect.TypeOf((*MockClient)(nil).ObjectPut), arg0, arg1) } -// ObjectSearchInitmocks base method. -func (m *MockClient) ObjectSearchInit(arg0 context.Context, arg1 client0.PrmObjectSearch) (*client0.ObjectListReader, error) { +// ObjectRange mocks base method. +func (m *MockClient) ObjectRange(arg0 context.Context, arg1 PrmObjectRange) (*ResObjectRange, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ObjectSearchInit", arg0, arg1) - ret0, _ := ret[0].(*client0.ObjectListReader) + ret := m.ctrl.Call(m, "ObjectRange", arg0, arg1) + ret0, _ := ret[0].(*ResObjectRange) ret1, _ := ret[1].(error) return ret0, ret1 } -// SearchObjects indicates an expected call of SearchObjects. -func (mr *MockClientMockRecorder) SearchObjects(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +// ObjectRange indicates an expected call of ObjectRange. +func (mr *MockClientMockRecorder) ObjectRange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchObjects", reflect.TypeOf((*MockClient)(nil).ObjectSearchInit), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectRange", reflect.TypeOf((*MockClient)(nil).ObjectRange), arg0, arg1) } -// SetEACL mocks base method. -func (m *MockClient) ContainerSetEACL(arg0 context.Context, arg1 client0.PrmContainerSetEACL) (*client0.ResContainerSetEACL, error) { +// ObjectSearch mocks base method. +func (m *MockClient) ObjectSearch(arg0 context.Context, arg1 PrmObjectSearch) (*ResObjectSearch, error) { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - ret := m.ctrl.Call(m, "ContainerSetEACL", varargs...) - ret0, _ := ret[0].(*client0.ResContainerSetEACL) + ret := m.ctrl.Call(m, "ObjectSearch", arg0, arg1) + ret0, _ := ret[0].(*ResObjectSearch) ret1, _ := ret[1].(error) return ret0, ret1 } -// SetEACL indicates an expected call of SetEACL. -func (mr *MockClientMockRecorder) SetEACL(arg0, arg1 interface{}) *gomock.Call { +// ObjectSearch indicates an expected call of ObjectSearch. +func (mr *MockClientMockRecorder) ObjectSearch(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSetEACL", reflect.TypeOf((*MockClient)(nil).ContainerSetEACL), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectSearch", reflect.TypeOf((*MockClient)(nil).ObjectSearch), arg0, arg1) +} + +// SessionCreate mocks base method. +func (m *MockClient) SessionCreate(arg0 context.Context, arg1 PrmCreateSession) (*ResCreateSession, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SessionCreate", arg0, arg1) + ret0, _ := ret[0].(*ResCreateSession) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SessionCreate indicates an expected call of SessionCreate. +func (mr *MockClientMockRecorder) SessionCreate(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SessionCreate", reflect.TypeOf((*MockClient)(nil).SessionCreate), arg0, arg1) } diff --git a/pool/pool_test.go b/pool/pool_test.go index 2d093b9..efe1b15 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -1,8 +1,10 @@ package pool +// To generate mock define 'type Client client' in pool.go //go:generate mockgen -destination mock_test.go -package pool . Client import ( + "bytes" "context" "crypto/ecdsa" "fmt" @@ -13,7 +15,7 @@ import ( "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - sdkClient "github.com/nspcc-dev/neofs-sdk-go/client" + "github.com/nspcc-dev/neofs-sdk-go/container" "github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object/address" @@ -49,9 +51,9 @@ func TestBuildPoolCreateSessionFailed(t *testing.T) { clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes() - mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResEndpointInfo{}, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes() + mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() return mockClient, nil } @@ -74,8 +76,6 @@ func newPrivateKey(t *testing.T) *ecdsa.PrivateKey { } func TestBuildPoolOneNodeFailed(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) ctrl2 := gomock.NewController(t) @@ -88,22 +88,25 @@ func TestBuildPoolOneNodeFailed(t *testing.T) { clientCount++ mockClient := NewMockClient(ctrl) mockInvokes := 0 - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*ResCreateSession, error) { mockInvokes++ if mockInvokes == 1 { expectedToken = newToken(t) return nil, fmt.Errorf("error session") } - return expectedToken, nil + return &ResCreateSession{ + sessionKey: expectedToken.SessionKey(), + id: expectedToken.ID(), + }, nil }).AnyTimes() mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() mockClient2 := NewMockClient(ctrl2) - mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() + mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes() mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() if clientCount == 0 { return mockClient, nil @@ -136,7 +139,7 @@ func TestBuildPoolOneNodeFailed(t *testing.T) { return false } st := clientPool.cache.Get(formCacheKey(cp.address, clientPool.key)) - return st == expectedToken + return areEqualTokens(st, expectedToken) } require.Never(t, condition, 900*time.Millisecond, 100*time.Millisecond) require.Eventually(t, condition, 3*time.Second, 300*time.Millisecond) @@ -151,8 +154,6 @@ func TestBuildPoolZeroNodes(t *testing.T) { } func TestOneNode(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) tok := session.NewToken() @@ -160,11 +161,16 @@ func TestOneNode(t *testing.T) { require.NoError(t, err) tok.SetID(uid) + tokRes := &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + } + clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(tok, nil) - mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResEndpointInfo{}, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(tokRes, nil) + mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() return mockClient, nil } @@ -183,27 +189,36 @@ func TestOneNode(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Equal(t, tok, st) + require.True(t, areEqualTokens(tok, st)) +} + +func areEqualTokens(t1, t2 *session.Token) bool { + if t1 == nil || t2 == nil { + return false + } + return bytes.Equal(t1.ID(), t2.ID()) && + bytes.Equal(t1.SessionKey(), t2.SessionKey()) } func TestTwoNodes(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) var tokens []*session.Token clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := session.NewToken() uid, err := uuid.New().MarshalBinary() require.NoError(t, err) tok.SetID(uid) tokens = append(tokens, tok) - return tok, err + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, err }) - mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResEndpointInfo{}, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() return mockClient, nil } @@ -225,12 +240,19 @@ func TestTwoNodes(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Contains(t, tokens, st) + require.True(t, containsTokens(tokens, st)) +} + +func containsTokens(list []*session.Token, item *session.Token) bool { + for _, tok := range list { + if areEqualTokens(tok, item) { + return true + } + } + return false } func TestOneOfTwoFailed(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) ctrl2 := gomock.NewController(t) @@ -239,24 +261,30 @@ func TestOneOfTwoFailed(t *testing.T) { clientBuilder := func(_ string) (client, error) { clientCount++ mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := newToken(t) tokens = append(tokens, tok) - return tok, nil + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, nil }).AnyTimes() mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() mockClient2 := NewMockClient(ctrl2) - mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := newToken(t) tokens = append(tokens, tok) - return tok, nil + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, nil }).AnyTimes() - mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*sdkClient.ResEndpointInfo, error) { + mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NodeInfo, error) { return nil, fmt.Errorf("error") }).AnyTimes() - mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*sdkClient.ResNetworkInfo, error) { + mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NetworkInfo, error) { return nil, fmt.Errorf("error") }).AnyTimes() @@ -290,20 +318,18 @@ func TestOneOfTwoFailed(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Equal(t, tokens[0], st) + require.True(t, areEqualTokens(tokens[0], st)) } } func TestTwoFailed(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes() mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() return mockClient, nil } @@ -332,24 +358,26 @@ func TestTwoFailed(t *testing.T) { } func TestSessionCache(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) var tokens []*session.Token clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*ResCreateSession, error) { tok := session.NewToken() uid, err := uuid.New().MarshalBinary() require.NoError(t, err) tok.SetID(uid) tokens = append(tokens, tok) - return tok, err + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, err }).MaxTimes(3) + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() - mockClient.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("session token does not exist")) - mockClient.EXPECT().PutObject(gomock.Any(), gomock.Any()).Return(nil, nil) + mockClient.EXPECT().ObjectGet(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("session token does not exist")) + mockClient.EXPECT().ObjectPut(gomock.Any(), gomock.Any()).Return(nil, nil) return mockClient, nil } @@ -376,10 +404,11 @@ func TestSessionCache(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Contains(t, tokens, st) + require.True(t, containsTokens(tokens, st)) var prm PrmObjectGet prm.SetAddress(address.Address{}) + prm.UseSession(*session.NewToken()) _, err = pool.GetObject(ctx, prm) require.Error(t, err) @@ -400,38 +429,40 @@ func TestSessionCache(t *testing.T) { cp, err = pool.connection() require.NoError(t, err) st = pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Contains(t, tokens, st) + require.True(t, containsTokens(tokens, st)) } func TestPriority(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) ctrl2 := gomock.NewController(t) - var tokens []*session.Token - clientCount := -1 - clientBuilder := func(_ string) (client, error) { - clientCount++ + tokens := make([]*session.Token, 2) + clientBuilder := func(endpoint string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := newToken(t) - tokens = append(tokens, tok) - return tok, nil + tokens[0] = tok + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, nil }).AnyTimes() mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() mockClient2 := NewMockClient(ctrl2) - mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := newToken(t) - tokens = append(tokens, tok) - return tok, nil + tokens[1] = tok + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, nil }).AnyTimes() - mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() - mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() + mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes() + mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() - if clientCount == 0 { + if endpoint == "peer0" { return mockClient, nil } return mockClient2, nil @@ -460,13 +491,13 @@ func TestPriority(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - return st == tokens[0] + return areEqualTokens(st, tokens[0]) } secondNode := func() bool { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - return st == tokens[1] + return areEqualTokens(st, tokens[1]) } require.Never(t, secondNode, time.Second, 200*time.Millisecond) @@ -475,23 +506,25 @@ func TestPriority(t *testing.T) { } func TestSessionCacheWithKey(t *testing.T) { - t.Skip("NeoFS API client can't be mocked") // neofs-sdk-go#85 - ctrl := gomock.NewController(t) var tokens []*session.Token clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) { + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) { tok := session.NewToken() uid, err := uuid.New().MarshalBinary() require.NoError(t, err) tok.SetID(uid) tokens = append(tokens, tok) - return tok, err + return &ResCreateSession{ + id: tok.ID(), + sessionKey: tok.SessionKey(), + }, err }).MaxTimes(2) - mockClient.EXPECT().GetObject(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil) + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().ObjectGet(gomock.Any(), gomock.Any()).Return(nil, nil) return mockClient, nil } @@ -517,7 +550,7 @@ func TestSessionCacheWithKey(t *testing.T) { cp, err := pool.connection() require.NoError(t, err) st := pool.cache.Get(formCacheKey(cp.address, pool.key)) - require.Contains(t, tokens, st) + require.True(t, containsTokens(tokens, st)) var prm PrmObjectGet prm.SetAddress(address.Address{}) @@ -543,9 +576,9 @@ func TestSessionTokenOwner(t *testing.T) { ctrl := gomock.NewController(t) clientBuilder := func(_ string) (client, error) { mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(&sdkClient.ResSessionCreate{}, nil).AnyTimes() - mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResEndpointInfo{}, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes() + mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() return mockClient, nil } @@ -571,11 +604,13 @@ func TestSessionTokenOwner(t *testing.T) { var prm prmCommon prm.UseKey(anonKey) - prm.useDefaultSession() + var prmCtx prmContext + prmCtx.useDefaultSession() + var cc callContext cc.Context = ctx cc.sessionTarget = func(session.Token) {} - err = p.initCallContext(&cc, prm) + err = p.initCallContext(&cc, prm, prmCtx) require.NoError(t, err) err = p.openDefaultSession(&cc) @@ -589,10 +624,10 @@ func TestWaitPresence(t *testing.T) { ctrl := gomock.NewController(t) mockClient := NewMockClient(ctrl) - mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() + mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes() - mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&sdkClient.ResNetworkInfo{}, nil).AnyTimes() - mockClient.EXPECT().GetContainer(gomock.Any(), gomock.Any()).Return(&sdkClient.ResContainerGet{}, nil).AnyTimes() + mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes() + mockClient.EXPECT().ContainerGet(gomock.Any(), gomock.Any()).Return(&container.Container{}, nil).AnyTimes() cache, err := newCache() require.NoError(t, err) diff --git a/pool/sampler_test.go b/pool/sampler_test.go index f41dbdb..fcfa91d 100644 --- a/pool/sampler_test.go +++ b/pool/sampler_test.go @@ -6,7 +6,7 @@ import ( "math/rand" "testing" - sdkClient "github.com/nspcc-dev/neofs-sdk-go/client" + "github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/stretchr/testify/require" ) @@ -43,16 +43,16 @@ func TestSamplerStability(t *testing.T) { } type clientMock struct { - sdkClient.Client + clientWrapper name string err error } -func (c *clientMock) EndpointInfo(context.Context, sdkClient.PrmEndpointInfo) (*sdkClient.ResEndpointInfo, error) { +func (c *clientMock) EndpointInfo(context.Context, PrmEndpointInfo) (*netmap.NodeInfo, error) { return nil, nil } -func (c *clientMock) NetworkInfo(context.Context, sdkClient.PrmNetworkInfo) (*sdkClient.ResNetworkInfo, error) { +func (c *clientMock) NetworkInfo(context.Context, PrmNetworkInfo) (*netmap.NetworkInfo, error) { return nil, nil }