Documentation
¶
Overview ¶
Package mockfoo mocks a server for the Foo service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockServer ¶
type MockServer struct { pb.FooServer // <<< VALIDATE CURRENT SERVICE SERVER Addr string // contains filtered or unexported fields }
MockServer satisfies the pb.FooServer interface
func NewServer ¶
func NewServer() (*MockServer, error)
NewServer configures and returns a MockServer
func (*MockServer) AddRPC ¶
func (s *MockServer) AddRPC(wantReq proto.Message, resp interface{})
AddRPC adds a (request, response) pair to the server's list of expected interactions. The server will compare the incoming request with wantReq using proto.Equal. The response can be a message or an error.
For the Listen RPC, resp should be a []interface{}, where each element is either ListenResponse or an error.
Passing nil for wantReq disables the request check.
func (*MockServer) AddRPCAdjust ¶
func (s *MockServer) AddRPCAdjust(wantReq proto.Message, resp interface{}, adjust func(gotReq proto.Message))
AddRPCAdjust is like AddRPC, but accepts a function that can be used to tweak the requests before comparison, for example to adjust for randomness.
func (*MockServer) Bar ¶
func (s *MockServer) Bar(_ context.Context, req *pb.BarRequest) (*pb.BarResponse, error)
Bar implements the FooServer Bar method
func (*MockServer) Reset ¶
func (s *MockServer) Reset()
Reset returns the MockServer to an empty state.