testservice

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testservice provides an interface for testing with the Test service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestService

type TestService struct {
	tgrpcpb.TestClient
	// contains filtered or unexported fields
}

TestService represents a running test service client and server.

func Start

func Start(ctx context.Context, t *testing.T, testSrv tgrpcpb.TestServer, opts ...grpc.DialOption) *TestService

Start starts the gRCP server with the specified TestServer implementation, dials the server, and returns a handle to the test service.

func (*TestService) MustSendStream

func (ts *TestService) MustSendStream(ctx context.Context, t *testing.T) *TestStreamClient

MustSendStream calls SendStream and fails the test fatally on error.

func (*TestService) MustSendUnary

func (ts *TestService) MustSendUnary(ctx context.Context, t *testing.T, msg string)

MustSendUnary calls SendUnary and fails the test fatally on error.

func (*TestService) Stop

func (ts *TestService) Stop()

Stop stops the TestService server.

type TestStreamClient

type TestStreamClient struct {
	tgrpcpb.Test_SendStreamClient
}

TestStreamClient is a SendStreamClient with additional Must methods.

func (*TestStreamClient) MustRecv

func (sc *TestStreamClient) MustRecv(t *testing.T) bool

MustRecv calls Recv and fails the test fatally on a non-EOF error. Returns true if a message is received (if there is no error or an EOF error).

func (*TestStreamClient) MustSend

func (sc *TestStreamClient) MustSend(t *testing.T, msg string)

MustSend calls Send and fails the test fatally on error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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