grpctest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registrant

type Registrant interface {
	// GRPCTestRegister registers gRPC server implementation on passed server.
	GRPCTestRegister(*grpc.Server)
}

Registrant should be implemented by generated gRPC mocks.

type Server

type Server struct {
	Listener net.Listener
	Server   *grpc.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...grpc.ServerOption) *Server

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Close

func (s *Server) Close()

func (*Server) Serve

func (s *Server) Serve(regs ...Registrant) *Server

Serve registers passed registerers and starts serving. Example: instance := &computemocks.InstanceServer{} instance.On("Get", mock.Anything, mock.Anything).Return(

func(context.Context, *compute.GetInstanceRequest) (*compute.Instance, error) {
    return &compute.Instance{}, nil
})

server := NewServer().Serve(instance) defer server.Close()

Jump to

Keyboard shortcuts

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