testing

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

# A simple unit and integration testing package

Documentation

Overview

Package testing is a simple package to help with testing gRPC services.

Index

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 (t *GrpcServiceTester) AddTestUserToCtx(ctx context.Context, outgoing bool) context.Context

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 Host

type Host string
const (
	None        Host = ""
	Lb          Host = "lb"
	InternalGw  Host = "internal-gw"
	ConsumersGw Host = "consumers-gw"
	Local8080   Host = "localhost:8080"
)

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

SetHeader(md), SendHeader(md) and SetTrailer(md)

func (*TestServerTransportStream) SetTrailer

func (t *TestServerTransportStream) SetTrailer(metadata.MD) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL