Documentation ¶
Index ¶
- Constants
- func ExpectCurlWithOffset(offset int, request CurlRequest, expectedResponse CurlResponse)
- func ExpectGrpcHealthOK(rootca *string, envoyPort uint32, service string)
- func ExpectHttpOK(body []byte, rootca *string, envoyPort uint32, response string)
- func ExpectHttpOKWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string)
- func ExpectHttpStatusWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string, ...)
- func ExpectHttpUnavailableWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string)
- func NewTestHttpUpstreamWithHandler(handler http.Handler) func(ctx context.Context, addr string) *TestUpstream
- func StartSslProxy(ctx context.Context, port uint32) uint32
- func StartSslProxyWithHelloCB(ctx context.Context, port uint32, cb func(chi *tls.ClientHelloInfo)) uint32
- func TestUpstreamReachable(envoyPort uint32, tu *TestUpstream, rootca *string)
- func TestUpstreamReachableWithOffset(offset int, envoyPort uint32, tu *TestUpstream, rootca *string)
- type CurlRequest
- type CurlResponse
- type ReceivedRequest
- type ReturnedResponse
- type TestUpstream
- func NewTestGRPCUpstream(ctx context.Context, addr string, replicas int) *TestUpstream
- func NewTestHttpUpstream(ctx context.Context, addr string) *TestUpstream
- func NewTestHttpUpstreamWithHttpbin(ctx context.Context, addr string) *TestUpstream
- func NewTestHttpUpstreamWithReply(ctx context.Context, addr, reply string) *TestUpstream
- func NewTestHttpUpstreamWithReplyAndHealthReply(ctx context.Context, addr, reply, healthReply string) *TestUpstream
- func NewTestHttpUpstreamWithTls(ctx context.Context, addr string, tlsServer UpstreamTlsRequired) *TestUpstream
- func NewTestHttpsUpstreamWithReply(ctx context.Context, addr, reply string) *TestUpstream
- type UpstreamTlsRequired
Constants ¶
const ( NO_TLS = iota TLS MTLS )
Variables ¶
This section is empty.
Functions ¶
func ExpectCurlWithOffset ¶ added in v1.9.25
func ExpectCurlWithOffset(offset int, request CurlRequest, expectedResponse CurlResponse)
ExpectCurlWithOffset is the preferred utility for asserting that a request to a port was received and returned the expectedResponse. It provides the same functionality as the above methods, but groups parameters into a CurlRequest and CurlResponse object, which helps us avoid frequently updating the method parameters whenever new properties are required (telescoping constructor anti-pattern:
func ExpectGrpcHealthOK ¶ added in v1.2.15
func ExpectHttpOK ¶ added in v0.18.3
func ExpectHttpOKWithOffset ¶ added in v1.5.6
func ExpectHttpStatusWithOffset ¶ added in v1.8.0
func ExpectHttpUnavailableWithOffset ¶ added in v1.8.0
func NewTestHttpUpstreamWithHandler ¶ added in v1.18.0
func NewTestHttpUpstreamWithHandler(handler http.Handler) func(ctx context.Context, addr string) *TestUpstream
NewTestHttpUpstreamWithHandler creates a test upstream that routes to a server that responds with the provided http.Handler.
func StartSslProxyWithHelloCB ¶ added in v1.5.5
func TestUpstreamReachable ¶ added in v0.14.0
func TestUpstreamReachable(envoyPort uint32, tu *TestUpstream, rootca *string)
func TestUpstreamReachableWithOffset ¶ added in v1.5.6
func TestUpstreamReachableWithOffset(offset int, envoyPort uint32, tu *TestUpstream, rootca *string)
Types ¶
type CurlRequest ¶ added in v1.9.25
type CurlResponse ¶ added in v1.9.25
type ReceivedRequest ¶
type ReceivedRequest struct { Method string Headers map[string][]string URL *url.URL Body []byte Host string GRPCRequest proto.Message Port uint32 }
func (*ReceivedRequest) String ¶ added in v1.13.18
func (rr *ReceivedRequest) String() string
type ReturnedResponse ¶ added in v1.13.18
func (*ReturnedResponse) String ¶ added in v1.13.18
func (rr *ReturnedResponse) String() string
type TestUpstream ¶
type TestUpstream struct { Upstream *gloov1.Upstream C <-chan *ReceivedRequest CResp <-chan *ReturnedResponse Address string Port uint32 GrpcServers []*testgrpcservice.TestGRPCServer }
TestUpstream is a testing utility (used in in-memory e2e tests) to compose the following concepts:
- Running an application with a custom response message (see: runTestServer)
- Configuring an Upstream object to route to that application (see: newTestUpstream)
- Utility methods for asserting that traffic was successfully routed to the application (see: Assertion Utilities)
func NewTestGRPCUpstream ¶ added in v0.17.0
func NewTestGRPCUpstream(ctx context.Context, addr string, replicas int) *TestUpstream
func NewTestHttpUpstream ¶
func NewTestHttpUpstream(ctx context.Context, addr string) *TestUpstream
func NewTestHttpUpstreamWithHttpbin ¶ added in v1.17.16
func NewTestHttpUpstreamWithHttpbin(ctx context.Context, addr string) *TestUpstream
NewTestHttpUpstreamWithHttpbin creates a test upstream that routes to a server that responds with go-httpbin. HTTPBin (https://httpbin.org/) provides common introspection endpoints and responses that can be used to simulate a variety of common HTTP behaviors.
func NewTestHttpUpstreamWithReply ¶ added in v0.18.29
func NewTestHttpUpstreamWithReply(ctx context.Context, addr, reply string) *TestUpstream
func NewTestHttpUpstreamWithReplyAndHealthReply ¶ added in v1.8.0
func NewTestHttpUpstreamWithReplyAndHealthReply(ctx context.Context, addr, reply, healthReply string) *TestUpstream
func NewTestHttpUpstreamWithTls ¶ added in v1.9.25
func NewTestHttpUpstreamWithTls(ctx context.Context, addr string, tlsServer UpstreamTlsRequired) *TestUpstream
func NewTestHttpsUpstreamWithReply ¶ added in v1.4.0
func NewTestHttpsUpstreamWithReply(ctx context.Context, addr, reply string) *TestUpstream
func (*TestUpstream) FailGrpcHealthCheck ¶ added in v0.18.36
func (tu *TestUpstream) FailGrpcHealthCheck() *testgrpcservice.TestGRPCServer
type UpstreamTlsRequired ¶ added in v1.14.0
type UpstreamTlsRequired int