Documentation ¶
Index ¶
- Constants
- type ContextMatcher
- type ContextMatcherOption
- type ContextTTL
- type FakeResponseWriter
- type MockClientConfig
- type MockClientConfigProvider
- type MockInbound
- type MockOnewayHandler
- type MockOnewayOutbound
- func (_m *MockOnewayOutbound) CallOneway(_param0 context.Context, _param1 *transport.Request) (transport.Ack, error)
- func (_m *MockOnewayOutbound) EXPECT() *_MockOnewayOutboundRecorder
- func (_m *MockOnewayOutbound) IsRunning() bool
- func (_m *MockOnewayOutbound) Start() error
- func (_m *MockOnewayOutbound) Stop() error
- func (_m *MockOnewayOutbound) Transports() []transport.Transport
- type MockRouteTable
- func (_m *MockRouteTable) Choose(_param0 context.Context, _param1 *transport.Request) (transport.HandlerSpec, error)
- func (_m *MockRouteTable) EXPECT() *_MockRouteTableRecorder
- func (_m *MockRouteTable) Procedures() []transport.Procedure
- func (_m *MockRouteTable) Register(_param0 []transport.Procedure)
- type MockRouter
- type MockUnaryHandler
- type MockUnaryOutbound
- func (_m *MockUnaryOutbound) Call(_param0 context.Context, _param1 *transport.Request) (*transport.Response, error)
- func (_m *MockUnaryOutbound) EXPECT() *_MockUnaryOutboundRecorder
- func (_m *MockUnaryOutbound) IsRunning() bool
- func (_m *MockUnaryOutbound) Start() error
- func (_m *MockUnaryOutbound) Stop() error
- func (_m *MockUnaryOutbound) Transports() []transport.Transport
- type RequestMatcher
- type ResponseMatcher
Constants ¶
const DefaultTTLDelta = 20 * time.Millisecond
DefaultTTLDelta is the default TTLDelta used by RequestMatchers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextMatcher ¶
ContextMatcher is a Matcher for verifying that a context's deadline is within expected bounds: the current time, plus a TTL, plus or minus some tolerance.
func NewContextMatcher ¶
func NewContextMatcher(t *testing.T, options ...ContextMatcherOption) *ContextMatcher
NewContextMatcher creates a ContextMatcher to verify properties about a Context.
func (*ContextMatcher) Matches ¶
func (c *ContextMatcher) Matches(got interface{}) bool
Matches a context against an expected context, returning true only if the given object is a context with a deadline that is now, plus the expected TTL, plus or minus some tolerance.
func (*ContextMatcher) String ¶
func (c *ContextMatcher) String() string
type ContextMatcherOption ¶
type ContextMatcherOption interface {
// contains filtered or unexported methods
}
ContextMatcherOption customizes the behavior of a ContextMatcher.
type ContextTTL ¶
ContextTTL requires that a Context have the given TTL on it, with a tolerance of TTLDelta.
type FakeResponseWriter ¶
type FakeResponseWriter struct { IsApplicationError bool Headers transport.Headers Body bytes.Buffer }
FakeResponseWriter is a ResponseWriter that records the headers and the body written to it.
func (*FakeResponseWriter) AddHeaders ¶
func (fw *FakeResponseWriter) AddHeaders(h transport.Headers)
AddHeaders for FakeResponseWriter.
func (*FakeResponseWriter) SetApplicationError ¶
func (fw *FakeResponseWriter) SetApplicationError()
SetApplicationError for FakeResponseWriter.
type MockClientConfig ¶
type MockClientConfig struct {
// contains filtered or unexported fields
}
Mock of ClientConfig interface
func NewMockClientConfig ¶
func NewMockClientConfig(ctrl *gomock.Controller) *MockClientConfig
func (*MockClientConfig) Caller ¶
func (_m *MockClientConfig) Caller() string
func (*MockClientConfig) EXPECT ¶
func (_m *MockClientConfig) EXPECT() *_MockClientConfigRecorder
func (*MockClientConfig) GetOnewayOutbound ¶
func (_m *MockClientConfig) GetOnewayOutbound() transport.OnewayOutbound
func (*MockClientConfig) GetUnaryOutbound ¶
func (_m *MockClientConfig) GetUnaryOutbound() transport.UnaryOutbound
func (*MockClientConfig) Service ¶
func (_m *MockClientConfig) Service() string
type MockClientConfigProvider ¶
type MockClientConfigProvider struct {
// contains filtered or unexported fields
}
Mock of ClientConfigProvider interface
func NewMockClientConfigProvider ¶
func NewMockClientConfigProvider(ctrl *gomock.Controller) *MockClientConfigProvider
func (*MockClientConfigProvider) ClientConfig ¶
func (_m *MockClientConfigProvider) ClientConfig(_param0 string) transport.ClientConfig
func (*MockClientConfigProvider) EXPECT ¶
func (_m *MockClientConfigProvider) EXPECT() *_MockClientConfigProviderRecorder
type MockInbound ¶
type MockInbound struct {
// contains filtered or unexported fields
}
Mock of Inbound interface
func NewMockInbound ¶
func NewMockInbound(ctrl *gomock.Controller) *MockInbound
func (*MockInbound) EXPECT ¶
func (_m *MockInbound) EXPECT() *_MockInboundRecorder
func (*MockInbound) IsRunning ¶
func (_m *MockInbound) IsRunning() bool
func (*MockInbound) SetRouter ¶
func (_m *MockInbound) SetRouter(_param0 transport.Router)
func (*MockInbound) Start ¶
func (_m *MockInbound) Start() error
func (*MockInbound) Stop ¶
func (_m *MockInbound) Stop() error
func (*MockInbound) Transports ¶
func (_m *MockInbound) Transports() []transport.Transport
type MockOnewayHandler ¶
type MockOnewayHandler struct {
// contains filtered or unexported fields
}
Mock of OnewayHandler interface
func NewMockOnewayHandler ¶
func NewMockOnewayHandler(ctrl *gomock.Controller) *MockOnewayHandler
func (*MockOnewayHandler) EXPECT ¶
func (_m *MockOnewayHandler) EXPECT() *_MockOnewayHandlerRecorder
func (*MockOnewayHandler) HandleOneway ¶
type MockOnewayOutbound ¶
type MockOnewayOutbound struct {
// contains filtered or unexported fields
}
Mock of OnewayOutbound interface
func NewMockOnewayOutbound ¶
func NewMockOnewayOutbound(ctrl *gomock.Controller) *MockOnewayOutbound
func (*MockOnewayOutbound) CallOneway ¶
func (*MockOnewayOutbound) EXPECT ¶
func (_m *MockOnewayOutbound) EXPECT() *_MockOnewayOutboundRecorder
func (*MockOnewayOutbound) IsRunning ¶
func (_m *MockOnewayOutbound) IsRunning() bool
func (*MockOnewayOutbound) Start ¶
func (_m *MockOnewayOutbound) Start() error
func (*MockOnewayOutbound) Stop ¶
func (_m *MockOnewayOutbound) Stop() error
func (*MockOnewayOutbound) Transports ¶
func (_m *MockOnewayOutbound) Transports() []transport.Transport
type MockRouteTable ¶
type MockRouteTable struct {
// contains filtered or unexported fields
}
Mock of RouteTable interface
func NewMockRouteTable ¶
func NewMockRouteTable(ctrl *gomock.Controller) *MockRouteTable
func (*MockRouteTable) Choose ¶
func (_m *MockRouteTable) Choose(_param0 context.Context, _param1 *transport.Request) (transport.HandlerSpec, error)
func (*MockRouteTable) EXPECT ¶
func (_m *MockRouteTable) EXPECT() *_MockRouteTableRecorder
func (*MockRouteTable) Procedures ¶
func (_m *MockRouteTable) Procedures() []transport.Procedure
func (*MockRouteTable) Register ¶
func (_m *MockRouteTable) Register(_param0 []transport.Procedure)
type MockRouter ¶
type MockRouter struct {
// contains filtered or unexported fields
}
Mock of Router interface
func NewMockRouter ¶
func NewMockRouter(ctrl *gomock.Controller) *MockRouter
func (*MockRouter) Choose ¶
func (_m *MockRouter) Choose(_param0 context.Context, _param1 *transport.Request) (transport.HandlerSpec, error)
func (*MockRouter) EXPECT ¶
func (_m *MockRouter) EXPECT() *_MockRouterRecorder
func (*MockRouter) Procedures ¶
func (_m *MockRouter) Procedures() []transport.Procedure
type MockUnaryHandler ¶
type MockUnaryHandler struct {
// contains filtered or unexported fields
}
Mock of UnaryHandler interface
func NewMockUnaryHandler ¶
func NewMockUnaryHandler(ctrl *gomock.Controller) *MockUnaryHandler
func (*MockUnaryHandler) EXPECT ¶
func (_m *MockUnaryHandler) EXPECT() *_MockUnaryHandlerRecorder
func (*MockUnaryHandler) Handle ¶
func (_m *MockUnaryHandler) Handle(_param0 context.Context, _param1 *transport.Request, _param2 transport.ResponseWriter) error
type MockUnaryOutbound ¶
type MockUnaryOutbound struct {
// contains filtered or unexported fields
}
Mock of UnaryOutbound interface
func NewMockUnaryOutbound ¶
func NewMockUnaryOutbound(ctrl *gomock.Controller) *MockUnaryOutbound
func (*MockUnaryOutbound) EXPECT ¶
func (_m *MockUnaryOutbound) EXPECT() *_MockUnaryOutboundRecorder
func (*MockUnaryOutbound) IsRunning ¶
func (_m *MockUnaryOutbound) IsRunning() bool
func (*MockUnaryOutbound) Start ¶
func (_m *MockUnaryOutbound) Start() error
func (*MockUnaryOutbound) Stop ¶
func (_m *MockUnaryOutbound) Stop() error
func (*MockUnaryOutbound) Transports ¶
func (_m *MockUnaryOutbound) Transports() []transport.Transport
type RequestMatcher ¶
type RequestMatcher struct {
// contains filtered or unexported fields
}
RequestMatcher may be used in gomock argument lists to assert that two requests match.
Requests are considered to be matching if:
- All their primitive parameters match.
- The headers of the received request include all the headers from the source request. It may include extra headers.
- The contents of the request bodies are the same.
func NewRequestMatcher ¶
func NewRequestMatcher(t *testing.T, r *transport.Request) RequestMatcher
NewRequestMatcher constructs a new RequestMatcher from the given testing.T and request.
The request's contents are read in their entirety and replaced with a bytes.Reader.
func (RequestMatcher) Matches ¶
func (m RequestMatcher) Matches(got interface{}) bool
Matches checks if the given object matches the Request provided in NewRequestMatcher.
func (RequestMatcher) String ¶
func (m RequestMatcher) String() string
type ResponseMatcher ¶
type ResponseMatcher struct {
// contains filtered or unexported fields
}
ResponseMatcher is similar to RequestMatcher but for responses.
func NewResponseMatcher ¶
func NewResponseMatcher(t *testing.T, r *transport.Response) ResponseMatcher
NewResponseMatcher builds a new ResponseMatcher that verifies that responses match the given Response.
func (ResponseMatcher) Matches ¶
func (m ResponseMatcher) Matches(got interface{}) bool
Matches checks if the given object matches the Response provided in NewResponseMatcher.