Documentation ¶
Index ¶
- func CreateDialContext(ctx context.Context, t *testing.T, clients *test.Clients) func(context.Context, string, string) (net.Conn, error)
- func CreateGRPCService(ctx context.Context, t *testing.T, clients *test.Clients, suffix string) (string, int, context.CancelFunc)
- func CreateHTTPRoute(ctx context.Context, t *testing.T, clients *test.Clients, ...) (*gatewayv1alpha1.HTTPRoute, context.CancelFunc)
- func CreateHTTPRouteReady(ctx context.Context, t *testing.T, clients *test.Clients, ...) (*gatewayv1alpha1.HTTPRoute, *http.Client, context.CancelFunc)
- func CreateProxyService(ctx context.Context, t *testing.T, clients *test.Clients, target string, ...) (string, int, context.CancelFunc)
- func CreateRetryService(ctx context.Context, t *testing.T, clients *test.Clients) (string, int, context.CancelFunc)
- func CreateRuntimeService(ctx context.Context, t *testing.T, clients *test.Clients, portName string) (string, int, context.CancelFunc)
- func CreateTLSSecret(ctx context.Context, t *testing.T, clients *test.Clients, hosts []string) (string, context.CancelFunc)
- func CreateTLSSecretWithCertPool(ctx context.Context, t *testing.T, clients *test.Clients, hosts []string, ...) (string, context.CancelFunc)
- func CreateTimeoutService(ctx context.Context, t *testing.T, clients *test.Clients) (string, int, context.CancelFunc)
- func CreateWebsocketService(ctx context.Context, t *testing.T, clients *test.Clients, suffix string) (string, int, context.CancelFunc)
- func DumpResponse(ctx context.Context, t *testing.T, resp *http.Response)
- func IsDialError(err error) bool
- func IsHTTPRouteReady(r *gatewayv1alpha1.HTTPRoute) (bool, error)
- func RunConformance(t *testing.T)
- func RuntimeRequest(ctx context.Context, t *testing.T, client *http.Client, url string, ...) *types.RuntimeInfo
- func RuntimeRequestWithExpectations(ctx context.Context, t *testing.T, client *http.Client, url string, ...) (*types.RuntimeInfo, bool)
- func TestBasics(t *testing.T)
- func TestBasicsHTTP2(t *testing.T)
- func TestGRPC(t *testing.T)
- func TestGRPCSplit(t *testing.T)
- func TestMultipleHosts(t *testing.T)
- func TestPath(t *testing.T)
- func TestPathAndPercentageSplit(t *testing.T)
- func TestPercentage(t *testing.T)
- func TestPostSplitSetHeaders(t *testing.T)
- func TestPreSplitSetHeaders(t *testing.T)
- func TestRewriteHost(t *testing.T)
- func TestRule(t *testing.T)
- func TestTagHeaders(t *testing.T)
- func TestTimeout(t *testing.T)
- func TestVisibility(t *testing.T)
- func TestVisibilityPath(t *testing.T)
- func TestVisibilitySplit(t *testing.T)
- func TestWebsocket(t *testing.T)
- func TestWebsocketSplit(t *testing.T)
- func WaitForHTTPRouteState(ctx context.Context, client *test.GatewayAPIClients, name string, ...) error
- type Option
- type RequestOption
- type ResponseExpectation
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 ¶
func CreateHTTPRoute(ctx context.Context, t *testing.T, clients *test.Clients, spec gatewayv1alpha1.HTTPRouteSpec, io ...Option) (*gatewayv1alpha1.HTTPRoute, context.CancelFunc)
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 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 ¶
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 ¶
TestBasics verifies that a no frills HTTPRoute exposes a simple Pod/Service via the public load balancer.
func TestBasicsHTTP2 ¶
TestBasicsHTTP2 verifies that the same no-frills HTTPRoute over a Service with http/2 configured will see a ProtoMajor of 2.
func TestGRPC ¶
TestGRPC verifies that GRPC may be used via a simple Ingress.
func TestGRPCSplit ¶
TestGRPCSplit verifies that websockets may be used across a traffic split.
func TestMultipleHosts ¶
TestMultipleHosts verifies that an Ingress can respond to multiple hosts.
func TestPath ¶
TestPath verifies that an Ingress properly dispatches to backends based on the path of the URL.
func TestPercentage ¶
TestPercentage verifies that an Ingress splitting over multiple backends respects the given percentage distribution.
func TestPostSplitSetHeaders ¶
TestPostSplitSetHeaders verifies that an Ingress that specified AppendHeaders post-split has the appropriate header(s) set.
func TestPreSplitSetHeaders ¶
TestPreSplitSetHeaders verifies that an Ingress that specified AppendHeaders pre-split has the appropriate header(s) set.
func TestRewriteHost ¶
TestRewriteHost verifies that a RewriteHost rule can be used to implement vanity URLs.
func TestRule ¶
TestRule verifies that an Ingress properly dispatches to backends based on different rules.
func TestTagHeaders ¶
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 ¶
TestTimeout verifies that an Ingress implements "no timeout".
func TestWebsocket ¶
TestWebsocket verifies that websockets may be used via a simple Ingress.
func TestWebsocketSplit ¶
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 ¶
OverrideHTTPRouteAnnotation overrides the HTTPRoute annotation.