Documentation
¶
Index ¶
- type MatcherMock
- type ServerStreamMock
- func (mock *ServerStreamMock) Context() context.Context
- func (mock *ServerStreamMock) ContextCalls() []struct{}
- func (mock *ServerStreamMock) RecvMsg(m any) error
- func (mock *ServerStreamMock) RecvMsgCalls() []struct{ ... }
- func (mock *ServerStreamMock) SendHeader(mD metadata.MD) error
- func (mock *ServerStreamMock) SendHeaderCalls() []struct{ ... }
- func (mock *ServerStreamMock) SendMsg(m any) error
- func (mock *ServerStreamMock) SendMsgCalls() []struct{ ... }
- func (mock *ServerStreamMock) SetHeader(mD metadata.MD) error
- func (mock *ServerStreamMock) SetHeaderCalls() []struct{ ... }
- func (mock *ServerStreamMock) SetTrailer(mD metadata.MD)
- func (mock *ServerStreamMock) SetTrailerCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MatcherMock ¶
type MatcherMock struct {
// MatchMetadataFunc mocks the MatchMetadata method.
MatchMetadataFunc func(s string, mD metadata.MD) discovery.Matches
// UpstreamsFunc mocks the Upstreams method.
UpstreamsFunc func() []discovery.Upstream
// contains filtered or unexported fields
}
MatcherMock is a mock implementation of proxy.Matcher.
func TestSomethingThatUsesMatcher(t *testing.T) {
// make and configure a mocked proxy.Matcher
mockedMatcher := &MatcherMock{
MatchMetadataFunc: func(s string, mD metadata.MD) discovery.Matches {
panic("mock out the MatchMetadata method")
},
UpstreamsFunc: func() []discovery.Upstream {
panic("mock out the Upstreams method")
},
}
// use mockedMatcher in code that requires proxy.Matcher
// and then make assertions.
}
func (*MatcherMock) MatchMetadata ¶
MatchMetadata calls MatchMetadataFunc.
func (*MatcherMock) MatchMetadataCalls ¶
func (mock *MatcherMock) MatchMetadataCalls() []struct { S string MD metadata.MD }
MatchMetadataCalls gets all the calls that were made to MatchMetadata. Check the length with:
len(mockedMatcher.MatchMetadataCalls())
func (*MatcherMock) Upstreams ¶ added in v0.3.0
func (mock *MatcherMock) Upstreams() []discovery.Upstream
Upstreams calls UpstreamsFunc.
func (*MatcherMock) UpstreamsCalls ¶ added in v0.3.0
func (mock *MatcherMock) UpstreamsCalls() []struct { }
UpstreamsCalls gets all the calls that were made to Upstreams. Check the length with:
len(mockedMatcher.UpstreamsCalls())
type ServerStreamMock ¶
type ServerStreamMock struct {
// ContextFunc mocks the Context method.
ContextFunc func() context.Context
// RecvMsgFunc mocks the RecvMsg method.
RecvMsgFunc func(m any) error
// SendHeaderFunc mocks the SendHeader method.
SendHeaderFunc func(mD metadata.MD) error
// SendMsgFunc mocks the SendMsg method.
SendMsgFunc func(m any) error
// SetHeaderFunc mocks the SetHeader method.
SetHeaderFunc func(mD metadata.MD) error
// SetTrailerFunc mocks the SetTrailer method.
SetTrailerFunc func(mD metadata.MD)
// contains filtered or unexported fields
}
ServerStreamMock is a mock implementation of proxy.ServerStream.
func TestSomethingThatUsesServerStream(t *testing.T) {
// make and configure a mocked proxy.ServerStream
mockedServerStream := &ServerStreamMock{
ContextFunc: func() context.Context {
panic("mock out the Context method")
},
RecvMsgFunc: func(m any) error {
panic("mock out the RecvMsg method")
},
SendHeaderFunc: func(mD metadata.MD) error {
panic("mock out the SendHeader method")
},
SendMsgFunc: func(m any) error {
panic("mock out the SendMsg method")
},
SetHeaderFunc: func(mD metadata.MD) error {
panic("mock out the SetHeader method")
},
SetTrailerFunc: func(mD metadata.MD) {
panic("mock out the SetTrailer method")
},
}
// use mockedServerStream in code that requires proxy.ServerStream
// and then make assertions.
}
func (*ServerStreamMock) Context ¶
func (mock *ServerStreamMock) Context() context.Context
Context calls ContextFunc.
func (*ServerStreamMock) ContextCalls ¶
func (mock *ServerStreamMock) ContextCalls() []struct { }
ContextCalls gets all the calls that were made to Context. Check the length with:
len(mockedServerStream.ContextCalls())
func (*ServerStreamMock) RecvMsg ¶
func (mock *ServerStreamMock) RecvMsg(m any) error
RecvMsg calls RecvMsgFunc.
func (*ServerStreamMock) RecvMsgCalls ¶
func (mock *ServerStreamMock) RecvMsgCalls() []struct { M any }
RecvMsgCalls gets all the calls that were made to RecvMsg. Check the length with:
len(mockedServerStream.RecvMsgCalls())
func (*ServerStreamMock) SendHeader ¶
func (mock *ServerStreamMock) SendHeader(mD metadata.MD) error
SendHeader calls SendHeaderFunc.
func (*ServerStreamMock) SendHeaderCalls ¶
func (mock *ServerStreamMock) SendHeaderCalls() []struct { MD metadata.MD }
SendHeaderCalls gets all the calls that were made to SendHeader. Check the length with:
len(mockedServerStream.SendHeaderCalls())
func (*ServerStreamMock) SendMsg ¶
func (mock *ServerStreamMock) SendMsg(m any) error
SendMsg calls SendMsgFunc.
func (*ServerStreamMock) SendMsgCalls ¶
func (mock *ServerStreamMock) SendMsgCalls() []struct { M any }
SendMsgCalls gets all the calls that were made to SendMsg. Check the length with:
len(mockedServerStream.SendMsgCalls())
func (*ServerStreamMock) SetHeader ¶
func (mock *ServerStreamMock) SetHeader(mD metadata.MD) error
SetHeader calls SetHeaderFunc.
func (*ServerStreamMock) SetHeaderCalls ¶
func (mock *ServerStreamMock) SetHeaderCalls() []struct { MD metadata.MD }
SetHeaderCalls gets all the calls that were made to SetHeader. Check the length with:
len(mockedServerStream.SetHeaderCalls())
func (*ServerStreamMock) SetTrailer ¶
func (mock *ServerStreamMock) SetTrailer(mD metadata.MD)
SetTrailer calls SetTrailerFunc.
func (*ServerStreamMock) SetTrailerCalls ¶
func (mock *ServerStreamMock) SetTrailerCalls() []struct { MD metadata.MD }
SetTrailerCalls gets all the calls that were made to SetTrailer. Check the length with:
len(mockedServerStream.SetTrailerCalls())