Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Call(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error Close() error }
Client defines interface for a client to make contextual remote calls.
type ClientMock ¶
type ClientMock struct { // CallFunc mocks the Call method. CallFunc func(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error // CloseFunc mocks the Close method. CloseFunc func() error // contains filtered or unexported fields }
ClientMock is a mock implementation of Client.
func TestSomethingThatUsesClient(t *testing.T) { // make and configure a mocked Client mockedClient := &ClientMock{ CallFunc: func(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error { panic("mock out the Call method") }, CloseFunc: func() error { panic("mock out the Close method") }, } // use mockedClient in code that requires Client // and then make assertions. }
func (*ClientMock) Call ¶
func (mock *ClientMock) Call(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error
Call calls CallFunc.
func (*ClientMock) CallCalls ¶
func (mock *ClientMock) CallCalls() []struct { Ctx context.Context ServiceMethod string Args interface{} Reply interface{} }
CallCalls gets all the calls that were made to Call. Check the length with:
len(mockedClient.CallCalls())
func (*ClientMock) CloseCalls ¶
func (mock *ClientMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedClient.CloseCalls())
type DialerFunc ¶
DialerFunc is an adapter to use ordinary functions as Dialer.
type RPCClient ¶
type RPCClient interface { Call(serviceMethod string, args interface{}, reply interface{}) error Close() error }
RPCClient describes a pure standard library rpc client.
type Redialer ¶
type Redialer struct {
// contains filtered or unexported fields
}
Redialer redials the RPC server with the provided repeating strategy, in case if Call has been failed.
func NewRedialer ¶
NewRedialer makes new instance of Redialer.
Click to show internal directories.
Click to hide internal directories.