testutil

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitFor

func WaitFor(timeout, interval time.Duration, condition func() bool) error

WaitFor waits for a condition to be met before the specified timeout

Types

type Server

type Server struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Server provides a local gRPC server with basic agora interceptors that can be used for testing with no external dependencies.

func NewServer

func NewServer(opts ...ServerOption) (*grpc.ClientConn, *Server, error)

NewServer creates a new Server.

func (*Server) RegisterService

func (s *Server) RegisterService(registerFunc func(s *grpc.Server))

RegisterService registers a gRPC service with Server.

func (*Server) Serve

func (s *Server) Serve() (stopFunc func(), err error)

Serve asynchronously starts the server, provided it has not been previously started or stopped. Callers should use stopFunc to stop the server in order to cleanup the underlying resources.

type ServerOption

type ServerOption func(o *serverOpts)

ServerOption configures the settings when creating a test server.

func WithStreamClientInterceptor

func WithStreamClientInterceptor(i grpc.StreamClientInterceptor) ServerOption

WithStreamClientInterceptor adds a stream client interceptor to the test client.

func WithStreamServerInterceptor

func WithStreamServerInterceptor(i grpc.StreamServerInterceptor) ServerOption

WithStreamServerInterceptor adds a stream server interceptor to the test client.

func WithUnaryClientInterceptor

func WithUnaryClientInterceptor(i grpc.UnaryClientInterceptor) ServerOption

WithUnaryClientInterceptor adds a unary client interceptor to the test client.

func WithUnaryServerInterceptor

func WithUnaryServerInterceptor(i grpc.UnaryServerInterceptor) ServerOption

WithUnaryServerInterceptor adds a unary server interceptor to the test client.

Jump to

Keyboard shortcuts

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