testutil

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Package testutil contains common util functions to facilitate tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffErrString

func DiffErrString(got error, want string) string

DiffErrString returns an empty diff string if the 'got' error message contains the 'want' string. Otherwise returns a diff string.

func FakeGRPCServer

func FakeGRPCServer(tb testing.TB, registerFunc RegisterFunc) (string, *grpc.ClientConn)

FakeGRPCServer creates and registers a fake grpc server for testing. It returns the bound address and a connected client. It ensures the server is stopped when tests finish. It returns an error if the connection does not establish.

func IsIntegration added in v0.1.2

func IsIntegration(tb testing.TB) bool

IsIntegration checks env var TEST_INTEGRATION and consider that we're in an integration test if it's set to true.

func SkipIfNotIntegration added in v0.1.2

func SkipIfNotIntegration(tb testing.TB)

SkipIfNotIntegration skips the test if IsIntegration returns false.

Types

type RegisterFunc

type RegisterFunc func(*grpc.Server)

RegisterFunc is the callback to register a fake gRPC service to the given server.

Jump to

Keyboard shortcuts

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