testing
v0.0.4
go.alis.build/testing
Documentation
pkg.go.dev ↗Package testing is a simple package to help with testing gRPC services.
Types
GrpcServiceTester
type GrpcServiceTester struct {
// contains filtered or unexported fields
}
NewGrpcServiceTester
func NewGrpcServiceTester(serverDescriptor *grpc.ServiceDesc, srv interface{}, unaryInterceptor grpc.UnaryServerInterceptor) *GrpcServiceTester
GrpcServiceTester.AddTestUserToCtx
func (t *GrpcServiceTester) AddTestUserToCtx(ctx context.Context, outgoing bool) context.Context
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.
GrpcServiceTester.WithHost
func (t *GrpcServiceTester) WithHost(host Host)
GrpcServiceTester.WithTestUser
func (t *GrpcServiceTester) WithTestUser(id string, email string)
Host
type Host string
None (5 declarations)
const ( None Host = "" Lb Host = "lb" InternalGw Host = "internal-gw" ConsumersGw Host = "consumers-gw" Local8080 Host = "localhost:8080" )
TestServerTransportStream
type TestServerTransportStream struct {
// contains filtered or unexported fields
}
TestServerTransportStream.Method
func (t *TestServerTransportStream) Method() string
TestServerTransportStream.SendHeader
func (t *TestServerTransportStream) SendHeader(metadata.MD) error
TestServerTransportStream.SetHeader
func (t *TestServerTransportStream) SetHeader(metadata.MD) error
SetHeader(md), SendHeader(md) and SetTrailer(md)
TestServerTransportStream.SetTrailer
func (t *TestServerTransportStream) SetTrailer(metadata.MD) error