Documentation ¶
Overview ¶
Package testing is a simple package to help with testing gRPC services.
Index ¶
- type GrpcServiceTester
- func (t *GrpcServiceTester) AddTestUserToCtx(ctx context.Context, outgoing bool) context.Context
- func (t *GrpcServiceTester) Test(ctx context.Context, req proto.Message, resp proto.Message) (interface{}, error)
- func (t *GrpcServiceTester) WithHost(host Host)
- func (t *GrpcServiceTester) WithTestUser(id string, email string)
- type Host
- type TestServerTransportStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrpcServiceTester ¶
type GrpcServiceTester struct {
// contains filtered or unexported fields
}
func NewGrpcServiceTester ¶
func NewGrpcServiceTester(serverDescriptor *grpc.ServiceDesc, srv interface{}, unaryInterceptor grpc.UnaryServerInterceptor) *GrpcServiceTester
func (*GrpcServiceTester) AddTestUserToCtx ¶
func (*GrpcServiceTester) Test ¶
func (t *GrpcServiceTester) Test(ctx context.Context, req proto.Message, resp proto.Message) (interface{}, error)
Test calls the service method for the given request and returns the response. resp is not the expected response but merely a means to unmarshal the response.
func (*GrpcServiceTester) WithHost ¶
func (t *GrpcServiceTester) WithHost(host Host)
func (*GrpcServiceTester) WithTestUser ¶
func (t *GrpcServiceTester) WithTestUser(id string, email string)
type TestServerTransportStream ¶
type TestServerTransportStream struct {
// contains filtered or unexported fields
}
func (*TestServerTransportStream) Method ¶
func (t *TestServerTransportStream) Method() string
func (*TestServerTransportStream) SendHeader ¶
func (t *TestServerTransportStream) SendHeader(metadata.MD) error
func (*TestServerTransportStream) SetHeader ¶
func (t *TestServerTransportStream) SetHeader(metadata.MD) error
SetHeader(md), SendHeader(md) and SetTrailer(md)
func (*TestServerTransportStream) SetTrailer ¶
func (t *TestServerTransportStream) SetTrailer(metadata.MD) error
Click to show internal directories.
Click to hide internal directories.