Documentation ¶
Index ¶
- Constants
- type ContextBaggage
- type ContextMatcher
- type ContextMatcherOption
- type ContextTTL
- type FakeResponseWriter
- type MockHandler
- type MockInbound
- type MockOutbound
- func (_m *MockOutbound) Call(_param0 context.Context, _param1 *transport.Request) (*transport.Response, error)
- func (_m *MockOutbound) EXPECT() *_MockOutboundRecorder
- func (_m *MockOutbound) Options() transport.Options
- func (_m *MockOutbound) Start(_param0 transport.Deps) error
- func (_m *MockOutbound) Stop() error
- 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 ContextBaggage ¶
ContextBaggage requires that the Context have the given baggage associated with it.
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 MockHandler ¶
type MockHandler struct {
// contains filtered or unexported fields
}
Mock of Handler interface
func NewMockHandler ¶
func NewMockHandler(ctrl *gomock.Controller) *MockHandler
func (*MockHandler) EXPECT ¶
func (_m *MockHandler) EXPECT() *_MockHandlerRecorder
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) Stop ¶
func (_m *MockInbound) Stop() error
type MockOutbound ¶
type MockOutbound struct {
// contains filtered or unexported fields
}
Mock of Outbound interface
func NewMockOutbound ¶
func NewMockOutbound(ctrl *gomock.Controller) *MockOutbound
func (*MockOutbound) EXPECT ¶
func (_m *MockOutbound) EXPECT() *_MockOutboundRecorder
func (*MockOutbound) Options ¶
func (_m *MockOutbound) Options() transport.Options
func (*MockOutbound) Stop ¶
func (_m *MockOutbound) Stop() error
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.