testing

package
v0.0.0-...-b563d55 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package testing provides primitives for testing API servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestServer

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

TestServer handles serving for a test.

func MustServeBindingForTest

func MustServeBindingForTest(tb testing.TB, bindings ...func(*apiserver.ServerParams)) *TestServer

MustServeBindingForTest is similar to MustServeForTest but it's used for binding functions that are lazily called.

func MustServeForTest

func MustServeForTest(tb testing.TB, params *apiserver.ServerParams) *TestServer

MustServeForTest creates an API server from parameters and returns a termination hook.

func (*TestServer) AddCloser

func (ts *TestServer) AddCloser(closer func() error)

AddCloser adds the close function to run when the server shuts down.

func (*TestServer) AddSilentCloser

func (ts *TestServer) AddSilentCloser(closer func())

AddSilentCloser adds the close function to run when the server shuts down.

func (*TestServer) Close

func (ts *TestServer) Close()

Close shutsdown the API server.

func (*TestServer) Context

func (ts *TestServer) Context() context.Context

Context provides the recommended context to use for test RPC calls.

func (*TestServer) GetGRPCAddress

func (ts *TestServer) GetGRPCAddress() string

GetGRPCAddress returns the gRPC serving address/

func (*TestServer) GetHTTPAddress

func (ts *TestServer) GetHTTPAddress() string

GetHTTPAddress returns the HTTP serving address.

func (*TestServer) MustGRPC

func (ts *TestServer) MustGRPC() *grpc.ClientConn

MustGRPC returns a grpc client configured to connect to an endpoint.

func (*TestServer) MustHTTP

func (ts *TestServer) MustHTTP() (*http.Client, string)

MustHTTP returns an HTTP client and base URL to communicate with the test server.

Jump to

Keyboard shortcuts

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