grpctest

package
Version: v1.106.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package grpctest helps testing GRPC services in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireError

func RequireError(t *testing.T, err error, code codes.Code, message string)

RequireError assets that the GRPC error is the expected one.

Types

type ClientMock

type ClientMock struct {
	// contains filtered or unexported fields
}

ClientMock contains all the info needed to mock client calls.

func Mock

func Mock() *ClientMock

Mock creates a new mock client.

func (*ClientMock) Conn

func (mock *ClientMock) Conn() *grpc.ClientConn

Conn returns a GRPC connection that uses the mock client when connecting.

func (*ClientMock) Set

func (mock *ClientMock) Set(name string, handler interface{})

Set assigns a method to a handler function that will be called in the mock. The name should be only the method name, not the service nor the package.

Jump to

Keyboard shortcuts

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