Documentation
¶
Index ¶
- type GrpcDefinition
- type GrpcMock
- func (m *GrpcMock) Addr() string
- func (m *GrpcMock) EndRunningContext() []error
- func (m *GrpcMock) GetRecordedRequests() []*RecordedRequest
- func (m *GrpcMock) ResetDefinitions()
- func (m *GrpcMock) SetDefinition(def *GrpcDefinition)
- func (m *GrpcMock) StartServer(addr string) error
- func (m *GrpcMock) Stop()
- type RecordedRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrpcDefinition ¶
type GrpcDefinition struct {
Service string
Method string
ExpectedRequest []byte // raw proto bytes of expected request (nil = skip verification)
Response []byte // raw proto bytes of response
ResponseStatus codes.Code // gRPC status code
Metadata map[string]string // trailing metadata
}
GrpcDefinition describes mock response for a single gRPC method.
type GrpcMock ¶
type GrpcMock struct {
// contains filtered or unexported fields
}
GrpcMock is a mock gRPC server analogous to mocks.ServiceMock for HTTP.
func (*GrpcMock) EndRunningContext ¶
EndRunningContext returns verification errors accumulated during the run.
func (*GrpcMock) GetRecordedRequests ¶
func (m *GrpcMock) GetRecordedRequests() []*RecordedRequest
GetRecordedRequests returns a copy of all recorded incoming requests.
func (*GrpcMock) ResetDefinitions ¶
func (m *GrpcMock) ResetDefinitions()
ResetDefinitions clears all definitions, recorded requests and errors.
func (*GrpcMock) SetDefinition ¶
func (m *GrpcMock) SetDefinition(def *GrpcDefinition)
SetDefinition registers a mock response definition for a gRPC method.
func (*GrpcMock) StartServer ¶
StartServer starts the gRPC server on the given address.
type RecordedRequest ¶
RecordedRequest is an incoming request captured by the mock server.
Click to show internal directories.
Click to hide internal directories.