ingress

package
v0.0.0-...-c9092c5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDialContext

func CreateDialContext(ctx context.Context, t *testing.T, clients *test.Clients) func(context.Context, string, string) (net.Conn, error)

CreateDialContext looks up the endpoint information to create a "dialer" for the provided HTTPRoute' public ingress loas balancer. It can be used to contact external-visibility services with an HTTP client via:

client := &http.Client{
	Transport: &http.Transport{
		DialContext: CreateDialContext(t, clients),
	},
}

func CreateGRPCService

func CreateGRPCService(ctx context.Context, t *testing.T, clients *test.Clients, suffix string) (string, int, context.CancelFunc)

CreateGRPCService creates a Kubernetes service that will upgrade the connection to use GRPC and echo back the received messages with the provided suffix.

func CreateHTTPRoute

CreateHTTPRoute creates a HTTPRoute resource

func CreateHTTPRouteReady

func CreateHTTPRouteReady(ctx context.Context, t *testing.T, clients *test.Clients, spec gatewayv1alpha1.HTTPRouteSpec, io ...Option) (*gatewayv1alpha1.HTTPRoute, *http.Client, context.CancelFunc)

func CreateProxyService

func CreateProxyService(ctx context.Context, t *testing.T, clients *test.Clients, target string, gatewayDomain string) (string, int, context.CancelFunc)

CreateProxyService creates a Kubernetes service that will forward requests to the specified target. It returns the service name, the port on which the service is listening, and a "cancel" function to clean up the created resources.

func CreateRetryService

func CreateRetryService(ctx context.Context, t *testing.T, clients *test.Clients) (string, int, context.CancelFunc)

CreateRetryService creates a service that will return a 503 on first access, and then 200 after that.

func CreateRuntimeService

func CreateRuntimeService(ctx context.Context, t *testing.T, clients *test.Clients, portName string) (string, int, context.CancelFunc)

CreateRuntimeService creates a Kubernetes service that will respond to the protocol specified with the given portName. It returns the service name, the port on which the service is listening, and a "cancel" function to clean up the created resources.

func CreateTLSSecret

func CreateTLSSecret(ctx context.Context, t *testing.T, clients *test.Clients, hosts []string) (string, context.CancelFunc)

CreateTLSSecret creates a secret with TLS certs in the serving namespace. This is based on https://golang.org/src/crypto/tls/generate_cert.go

func CreateTLSSecretWithCertPool

func CreateTLSSecretWithCertPool(ctx context.Context, t *testing.T, clients *test.Clients, hosts []string, ns string, cas *x509.CertPool) (string, context.CancelFunc)

CreateTLSSecretWithCertPool creates TLS certificate with given CertPool.

func CreateTimeoutService

func CreateTimeoutService(ctx context.Context, t *testing.T, clients *test.Clients) (string, int, context.CancelFunc)

CreateTimeoutService creates a Kubernetes service that will respond to the protocol specified with the given portName. It returns the service name, the port on which the service is listening, and a "cancel" function to clean up the created resources.

func CreateWebsocketService

func CreateWebsocketService(ctx context.Context, t *testing.T, clients *test.Clients, suffix string) (string, int, context.CancelFunc)

CreateWebsocketService creates a Kubernetes service that will upgrade the connection to use websockets and echo back the received messages with the provided suffix.

func DumpResponse

func DumpResponse(ctx context.Context, t *testing.T, resp *http.Response)

func IsDialError

func IsDialError(err error) bool

func IsHTTPRouteReady

func IsHTTPRouteReady(r *gatewayv1alpha1.HTTPRoute) (bool, error)

IsHTTPRouteReady will check the status conditions of the ingress and return true if all gateways have been admitted.

func RunConformance

func RunConformance(t *testing.T)

RunConformance will run ingress conformance tests

Depending on the options it may test alpha and beta features

func RuntimeRequest

func RuntimeRequest(ctx context.Context, t *testing.T, client *http.Client, url string, opts ...RequestOption) *types.RuntimeInfo

func RuntimeRequestWithExpectations

func RuntimeRequestWithExpectations(ctx context.Context, t *testing.T, client *http.Client, url string,
	responseExpectations []ResponseExpectation,
	allowDialError bool,
	opts ...RequestOption) (*types.RuntimeInfo, bool)

RuntimeRequestWithExpectations attempts to make a request to url and return runtime information. If connection is successful only then it will validate all response expectations. If allowDialError is set to true then function will not fail if connection is a dial error.

func TestBasics

func TestBasics(t *testing.T)

TestBasics verifies that a no frills HTTPRoute exposes a simple Pod/Service via the public load balancer.

func TestBasicsHTTP2

func TestBasicsHTTP2(t *testing.T)

TestBasicsHTTP2 verifies that the same no-frills HTTPRoute over a Service with http/2 configured will see a ProtoMajor of 2.

func TestGRPC

func TestGRPC(t *testing.T)

TestGRPC verifies that GRPC may be used via a simple Ingress.

func TestGRPCSplit

func TestGRPCSplit(t *testing.T)

TestGRPCSplit verifies that websockets may be used across a traffic split.

func TestMultipleHosts

func TestMultipleHosts(t *testing.T)

TestMultipleHosts verifies that an Ingress can respond to multiple hosts.

func TestPath

func TestPath(t *testing.T)

TestPath verifies that an Ingress properly dispatches to backends based on the path of the URL.

func TestPathAndPercentageSplit

func TestPathAndPercentageSplit(t *testing.T)

func TestPercentage

func TestPercentage(t *testing.T)

TestPercentage verifies that an Ingress splitting over multiple backends respects the given percentage distribution.

func TestPostSplitSetHeaders

func TestPostSplitSetHeaders(t *testing.T)

TestPostSplitSetHeaders verifies that an Ingress that specified AppendHeaders post-split has the appropriate header(s) set.

func TestPreSplitSetHeaders

func TestPreSplitSetHeaders(t *testing.T)

TestPreSplitSetHeaders verifies that an Ingress that specified AppendHeaders pre-split has the appropriate header(s) set.

func TestRewriteHost

func TestRewriteHost(t *testing.T)

TestRewriteHost verifies that a RewriteHost rule can be used to implement vanity URLs.

func TestRule

func TestRule(t *testing.T)

TestRule verifies that an Ingress properly dispatches to backends based on different rules.

func TestTagHeaders

func TestTagHeaders(t *testing.T)

TestTagHeaders verifies that an Ingress properly dispatches to backends based on the tag header

See proposal doc for reference: https://docs.google.com/document/d/12t_3NE4EqvW_l0hfVlQcAGKkwkAM56tTn2wN_JtHbSQ/edit?usp=sharing

func TestTimeout

func TestTimeout(t *testing.T)

TestTimeout verifies that an Ingress implements "no timeout".

func TestVisibility

func TestVisibility(t *testing.T)

func TestVisibilityPath

func TestVisibilityPath(t *testing.T)

func TestVisibilitySplit

func TestVisibilitySplit(t *testing.T)

func TestWebsocket

func TestWebsocket(t *testing.T)

TestWebsocket verifies that websockets may be used via a simple Ingress.

func TestWebsocketSplit

func TestWebsocketSplit(t *testing.T)

TestWebsocketSplit verifies that websockets may be used across a traffic split.

func WaitForHTTPRouteState

func WaitForHTTPRouteState(ctx context.Context, client *test.GatewayAPIClients, name string, inState func(r *gatewayv1alpha1.HTTPRoute) (bool, error), desc string) error

WaitForHTTPRouteState polls the status of the Ingress called name from client every PollInterval until inState returns `true` indicating it is done, returns an error or PollTimeout. desc will be used to name the metric that is emitted to track how long it took for name to get into the state checked by inState.

Types

type Option

type Option func(*gatewayv1alpha1.HTTPRoute)

Option enables further configuration of a HTTPRoute.

func OverrideHTTPRouteAnnotation

func OverrideHTTPRouteAnnotation(annotations map[string]string) Option

OverrideHTTPRouteAnnotation overrides the HTTPRoute annotation.

func OverrideHTTPRouteLabel

func OverrideHTTPRouteLabel(labels map[string]string) Option

OverrideHTTPRouteLabel overrides the HTTPRoute label.

type RequestOption

type RequestOption func(*http.Request)

type ResponseExpectation

type ResponseExpectation func(response *http.Response) error

func StatusCodeExpectation

func StatusCodeExpectation(statusCodes sets.Int) ResponseExpectation

Jump to

Keyboard shortcuts

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