v1helpers

package
v1.17.18 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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 ExpectGrpcHealthOK(rootca *string, envoyPort uint32, service string)

func ExpectHttpOK added in v0.18.3

func ExpectHttpOK(body []byte, rootca *string, envoyPort uint32, response string)

func ExpectHttpOKWithOffset added in v1.5.6

func ExpectHttpOKWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string)

func ExpectHttpStatusWithOffset added in v1.8.0

func ExpectHttpStatusWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string, status int)

func ExpectHttpUnavailableWithOffset added in v1.8.0

func ExpectHttpUnavailableWithOffset(offset int, body []byte, rootca *string, envoyPort uint32, response string)

func StartSslProxy

func StartSslProxy(ctx context.Context, port uint32) uint32

func StartSslProxyWithHelloCB added in v1.5.5

func StartSslProxyWithHelloCB(ctx context.Context, port uint32, cb func(chi *tls.ClientHelloInfo)) uint32

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 CurlRequest struct {
	RootCA  *string
	Port    uint32
	Path    string
	Body    []byte
	Host    string
	Headers map[string]string
}

type CurlResponse added in v1.9.25

type CurlResponse struct {
	Status  int
	Message string
}

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

type ReturnedResponse struct {
	Code    int
	Body    []byte
	Headers map[string][]string
}

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:

  1. Running an application with a custom response message (see: runTestServer)
  2. Configuring an Upstream object to route to that application (see: newTestUpstream)
  3. 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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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