testutil

package
v0.0.0-...-285cedf Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ceq

func Ceq(t *testing.T, expected, actual interface{}, eq func(a, b interface{}) bool, context ...interface{}) bool

Ceq is a custom equals check; the given function returns true if its arguments are equal

func Cneq

func Cneq(t *testing.T, unexpected, actual interface{}, eq func(a, b interface{}) bool, context ...interface{}) bool

Cneq is a custom not-equals check; the given function returns true if its arguments are equal

func Eq

func Eq(t *testing.T, expected, actual interface{}, context ...interface{}) bool

Eq asserts that the given two values are equal

func Neq

func Neq(t *testing.T, unexpected, actual interface{}, context ...interface{}) bool

Neq asserts that the given two values are not equal

func Nok

func Nok(t *testing.T, err error, context ...interface{})

Nok asserts that the given error is not nil

func Ok

func Ok(t *testing.T, err error, context ...interface{})

Ok asserts that the given error is nil

func Require

func Require(t *testing.T, condition bool, context ...interface{})

Require is an assertion that logs a failure if its given argument is not true

Types

type TestService

type TestService struct {
	grpc_testing.UnimplementedTestServiceServer
}

TestService is a very simple test service that just echos back request payloads

func (TestService) EmptyCall

EmptyCall satisfies the grpc_testing.TestServiceServer interface. It always succeeds.

func (TestService) FullDuplexCall

FullDuplexCall satisfies the grpc_testing.TestServiceServer interface. It only fails if the client cancels or disconnects (thus causing ss.Send to return an error). For each request message it receives, it sends back a response message with the same payload.

func (TestService) HalfDuplexCall

HalfDuplexCall satisfies the grpc_testing.TestServiceServer interface. It only fails if the client cancels or disconnects (thus causing ss.Send to return an error). For each request message it receives, it sends back a response message with the same payload. But since it is half-duplex, all of the request payloads are buffered and responses will only be sent after the request stream is half-closed.

func (TestService) StreamingInputCall

StreamingInputCall satisfies the grpc_testing.TestServiceServer interface. It always succeeds, sending back the total observed size of all request payloads.

func (TestService) StreamingOutputCall

StreamingOutputCall satisfies the grpc_testing.TestServiceServer interface. It only fails if the client cancels or disconnects (thus causing ss.Send to return an error). It echoes a number of responses equal to the request's number of response parameters. The requested parameter details, however, ignored. The response payload is always an echo of the request payload.

func (TestService) UnaryCall

UnaryCall satisfies the grpc_testing.TestServiceServer interface. It always succeeds, echoing back the payload present in the request.

Jump to

Keyboard shortcuts

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