grpctest

package
v1.54.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 12 Imported by: 0

README

grpctest

GoDoc

Package grpctest helps testing GRPC services in Go.

Install
import (
	"libs.altipla.consulting/grpctest"
)
Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

Running tests

Run the tests:

make test
License

MIT License

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