Documentation ¶
Overview ¶
Package testing provides primitives for testing API servers.
Index ¶
- type TestServer
- func (ts *TestServer) AddCloser(closer func() error)
- func (ts *TestServer) AddSilentCloser(closer func())
- func (ts *TestServer) Close()
- func (ts *TestServer) Context() context.Context
- func (ts *TestServer) GetGRPCAddress() string
- func (ts *TestServer) GetHTTPAddress() string
- func (ts *TestServer) MustGRPC() *grpc.ClientConn
- func (ts *TestServer) MustHTTP() (*http.Client, string)
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) 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.