Documentation ¶
Index ¶
- Constants
- type Provider
- func (p *Provider) AssertCurlResponse(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...)
- func (p *Provider) AssertCurlReturnResponse(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...) *http.Response
- func (p *Provider) AssertEnvoyAdminApi(ctx context.Context, envoyDeployment metav1.ObjectMeta, ...)
- func (p *Provider) AssertEventualCurlError(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...)
- func (p *Provider) AssertEventualCurlResponse(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...)
- func (p *Provider) AssertEventualCurlReturnResponse(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...) *http.Response
- func (p *Provider) AssertEventuallyConsistentCurlResponse(ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, ...)
- func (p *Provider) AssertGlooAdminApi(ctx context.Context, glooDeployment metav1.ObjectMeta, ...)
- func (p *Provider) ConsistentlyObjectsNotExist(ctx context.Context, objects ...client.Object)
- func (p *Provider) ConsistentlyResourceExists(ctx context.Context, getter helpers.ResourceGetter)
- func (p *Provider) CurlConsistentlyRespondsWithStatus(ctx context.Context, host string, status int)
- func (p *Provider) CurlEventuallyRespondsWithStatus(ctx context.Context, host string, status int)
- func (p *Provider) CurlRespondsWithStatus(ctx context.Context, host string, status int)
- func (p *Provider) CurlWithHeadersConsistentlyRespondsWithStatus(ctx context.Context, host string, headers map[string]string, status int)
- func (p *Provider) CurlWithHeadersEventuallyRespondsWithStatus(ctx context.Context, host string, headers map[string]string, status int)
- func (p *Provider) CurlWithHeadersRespondsWithStatus(ctx context.Context, host string, headers map[string]string, status int)
- func (p *Provider) EventuallyCheckResourcesOk(ctx context.Context)
- func (p *Provider) EventuallyGatewayCondition(ctx context.Context, gatewayName string, gatewayNamespace string, ...)
- func (p *Provider) EventuallyGatewayListenerAttachedRoutes(ctx context.Context, gatewayName string, gatewayNamespace string, ...)
- func (p *Provider) EventuallyGlooReachesConsistentState(installNamespace string)
- func (p *Provider) EventuallyHTTPRouteStatusContainsMessage(ctx context.Context, routeName string, routeNamespace string, message string, ...)
- func (p *Provider) EventuallyHTTPRouteStatusContainsReason(ctx context.Context, routeName string, routeNamespace string, reason string, ...)
- func (p *Provider) EventuallyInstallationSucceeded(ctx context.Context)
- func (p *Provider) EventuallyMatchesVersion(ctx context.Context, serverVersion string)
- func (p *Provider) EventuallyObjectTypesNotExist(ctx context.Context, objectLists ...client.ObjectList)
- func (p *Provider) EventuallyObjectsExist(ctx context.Context, objects ...client.Object)
- func (p *Provider) EventuallyObjectsNotExist(ctx context.Context, objects ...client.Object)
- func (p *Provider) EventuallyPodsMatches(ctx context.Context, podNamespace string, listOpt metav1.ListOptions, ...)
- func (p *Provider) EventuallyPodsRunning(ctx context.Context, podNamespace string, listOpt metav1.ListOptions, ...)
- func (p *Provider) EventuallyResourceExists(getter helpers.ResourceGetter, timeout ...time.Duration)
- func (p *Provider) EventuallyResourceStatusMatchesRejectedReasons(getter helpers.InputResourceGetter, desiredStatusReasons []string, ...)
- func (p *Provider) EventuallyResourceStatusMatchesState(getter helpers.InputResourceGetter, desiredState core.Status_State, ...)
- func (p *Provider) EventuallyResourceStatusMatchesSubResource(getter helpers.InputResourceGetter, desiredSubresourceName string, ...)
- func (p *Provider) EventuallyResourceStatusMatchesWarningReasons(getter helpers.InputResourceGetter, desiredStatusReasons []string, ...)
- func (p *Provider) EventuallyRunningReplicas(ctx context.Context, deploymentMeta metav1.ObjectMeta, ...)
- func (p *Provider) EventuallyTCPRouteCondition(ctx context.Context, routeName string, routeNamespace string, ...)
- func (p *Provider) EventuallyUninstallationSucceeded(ctx context.Context)
- func (p *Provider) EventuallyUpgradeSucceeded(ctx context.Context, version string)
- func (p *Provider) ExpectGlooObjectNotExist(ctx context.Context, getter helpers.InputResourceGetter, ...)
- func (p *Provider) ExpectNamespaceNotExist(ctx context.Context, ns string)
- func (p *Provider) ExpectObjectAdmitted(manifest string, err error, actualOutput, expectedOutput string)
- func (p *Provider) ExpectObjectDeleted(manifest string, err error, actualOutput string)
- func (p *Provider) InputSnapshotContainsElement(gvk schema.GroupVersionKind, meta metav1.ObjectMeta) func(ctx context.Context, adminClient *admincli.Client)
- func (p *Provider) InputSnapshotDoesNotContainElement(gvk schema.GroupVersionKind, meta metav1.ObjectMeta) func(ctx context.Context, adminClient *admincli.Client)
- func (p *Provider) InputSnapshotMatches(inputSnapshotMatcher types.GomegaMatcher) func(ctx context.Context, adminClient *admincli.Client)
- func (p *Provider) WithClusterContext(clusterContext *cluster.Context) *Provider
- func (p *Provider) WithGlooGatewayContext(ggCtx *gloogateway.Context) *Provider
Constants ¶
const (
GatewayProxyName = "gateway-proxy"
)
const WebhookReject = "webhook-reject"
WebhookReject is a well-known string that should be placed in the filename of any manifest which should be rejected by the Gloo Gateway validating webhook if it is enabled and configured to reject on errors. This acts as signal for any assertion which needs to know if the manifest is expected to not be admitted to the cluster.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct { Assert *assert.Assertions Require *require.Assertions // Gomega is well-used around the codebase, so we also add support here // NOTE TO DEVELOPERS: We recommend relying on testify assertions where possible Gomega gomega.Gomega // contains filtered or unexported fields }
Provider is the entity that provides methods which assert behaviors of a Kubernetes Cluster These assertions occur against a running instance of Gloo Gateway, within a Kubernetes Cluster.
func NewProvider ¶
NewProvider returns a Provider that will provide Assertions that can be executed against an installation of Gloo Gateway
func (*Provider) AssertCurlResponse ¶
func (p *Provider) AssertCurlResponse( ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, expectedResponse *matchers.HttpResponse, )
func (*Provider) AssertCurlReturnResponse ¶
func (*Provider) AssertEnvoyAdminApi ¶
func (*Provider) AssertEventualCurlError ¶ added in v1.17.5
func (p *Provider) AssertEventualCurlError( ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, expectedErrorCode int, timeout ...time.Duration, )
AssertEventualCurlError asserts that the response from a curl command is an error such as `Failed to connect` as opposed to an http error from the server. This is useful when testing that a service is not reachable, for example to validate that a delete operation has taken effect.
func (*Provider) AssertEventualCurlResponse ¶
func (p *Provider) AssertEventualCurlResponse( ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, expectedResponse *matchers.HttpResponse, timeout ...time.Duration, )
We can't use one function and ignore the response because the response body must be closed
func (*Provider) AssertEventualCurlReturnResponse ¶
func (*Provider) AssertEventuallyConsistentCurlResponse ¶
func (p *Provider) AssertEventuallyConsistentCurlResponse( ctx context.Context, podOpts kubectl.PodExecOptions, curlOptions []curl.Option, expectedResponse *matchers.HttpResponse, timeout ...time.Duration, )
AssertEventuallyConsistentCurlResponse asserts that the response from a curl command eventually and then consistently matches the expected response
func (*Provider) AssertGlooAdminApi ¶ added in v1.17.4
func (*Provider) ConsistentlyObjectsNotExist ¶
func (*Provider) ConsistentlyResourceExists ¶
func (p *Provider) ConsistentlyResourceExists(ctx context.Context, getter helpers.ResourceGetter)
func (*Provider) CurlConsistentlyRespondsWithStatus ¶ added in v1.17.9
func (*Provider) CurlEventuallyRespondsWithStatus ¶ added in v1.17.9
func (*Provider) CurlRespondsWithStatus ¶ added in v1.17.9
func (*Provider) CurlWithHeadersConsistentlyRespondsWithStatus ¶ added in v1.17.9
func (*Provider) CurlWithHeadersEventuallyRespondsWithStatus ¶ added in v1.17.9
func (*Provider) CurlWithHeadersRespondsWithStatus ¶ added in v1.17.9
func (*Provider) EventuallyCheckResourcesOk ¶
EventuallyCheckResourcesOk asserts that `glooctl check` eventually responds Ok
func (*Provider) EventuallyGatewayCondition ¶
func (p *Provider) EventuallyGatewayCondition( ctx context.Context, gatewayName string, gatewayNamespace string, cond gwv1.GatewayConditionType, expect metav1.ConditionStatus, timeout ...time.Duration, )
EventuallyGatewayCondition checks the provided Gateway condition is set to expect.
func (*Provider) EventuallyGatewayListenerAttachedRoutes ¶
func (p *Provider) EventuallyGatewayListenerAttachedRoutes( ctx context.Context, gatewayName string, gatewayNamespace string, listener gwv1.SectionName, routes int32, timeout ...time.Duration, )
EventuallyGatewayListenerAttachedRoutes checks the provided Gateway contains the expected attached routes for the listener.
func (*Provider) EventuallyGlooReachesConsistentState ¶
func (*Provider) EventuallyHTTPRouteStatusContainsMessage ¶
func (p *Provider) EventuallyHTTPRouteStatusContainsMessage( ctx context.Context, routeName string, routeNamespace string, message string, timeout ...time.Duration)
EventuallyHTTPRouteStatusContainsMessage asserts that eventually at least one of the HTTPRoute's route parent statuses contains the given message substring.
func (*Provider) EventuallyHTTPRouteStatusContainsReason ¶
func (p *Provider) EventuallyHTTPRouteStatusContainsReason( ctx context.Context, routeName string, routeNamespace string, reason string, timeout ...time.Duration)
EventuallyHTTPRouteStatusContainsReason asserts that eventually at least one of the HTTPRoute's route parent statuses contains the given reason substring.
func (*Provider) EventuallyInstallationSucceeded ¶
func (*Provider) EventuallyMatchesVersion ¶
EventuallyMatchesVersion asserts that `glooctl version` eventually responds with the expected server version
func (*Provider) EventuallyObjectTypesNotExist ¶
func (p *Provider) EventuallyObjectTypesNotExist(ctx context.Context, objectLists ...client.ObjectList)
EventuallyObjectTypesNotExist asserts that eventually no objects of the specified types exist on the cluster. The `objectLists` holds the object list types to check, e.g. to check that no HTTPRoutes exist on the cluster, pass in HTTPRouteList{}
func (*Provider) EventuallyObjectsExist ¶
func (*Provider) EventuallyObjectsNotExist ¶
func (*Provider) EventuallyPodsMatches ¶
func (p *Provider) EventuallyPodsMatches( ctx context.Context, podNamespace string, listOpt metav1.ListOptions, matcher types.GomegaMatcher, timeout ...time.Duration, )
EventuallyPodsMatches asserts that the pod(s) in the given namespace matches the provided matcher
func (*Provider) EventuallyPodsRunning ¶
func (p *Provider) EventuallyPodsRunning( ctx context.Context, podNamespace string, listOpt metav1.ListOptions, timeout ...time.Duration, )
EventuallyPodsRunning asserts that the pod(s) are in the ready state
func (*Provider) EventuallyResourceExists ¶
func (p *Provider) EventuallyResourceExists(getter helpers.ResourceGetter, timeout ...time.Duration)
func (*Provider) EventuallyResourceStatusMatchesRejectedReasons ¶ added in v1.17.2
func (*Provider) EventuallyResourceStatusMatchesState ¶
func (p *Provider) EventuallyResourceStatusMatchesState( getter helpers.InputResourceGetter, desiredState core.Status_State, desiredReporter string, timeout ...time.Duration, )
func (*Provider) EventuallyResourceStatusMatchesSubResource ¶ added in v1.17.2
func (p *Provider) EventuallyResourceStatusMatchesSubResource( getter helpers.InputResourceGetter, desiredSubresourceName string, desiredSubresource matchers.SoloKitSubresourceStatus, timeout ...time.Duration, )
func (*Provider) EventuallyResourceStatusMatchesWarningReasons ¶
func (p *Provider) EventuallyResourceStatusMatchesWarningReasons(getter helpers.InputResourceGetter, desiredStatusReasons []string, desiredReporter string, timeout ...time.Duration)
Checks GetNamespacedStatuses status for gloo installation namespace
func (*Provider) EventuallyRunningReplicas ¶
func (p *Provider) EventuallyRunningReplicas(ctx context.Context, deploymentMeta metav1.ObjectMeta, replicaMatcher types.GomegaMatcher)
func (*Provider) EventuallyTCPRouteCondition ¶
func (p *Provider) EventuallyTCPRouteCondition( ctx context.Context, routeName string, routeNamespace string, cond gwv1.RouteConditionType, expect metav1.ConditionStatus, timeout ...time.Duration, )
EventuallyTCPRouteCondition checks that provided TCPRoute condition is set to expect.
func (*Provider) EventuallyUninstallationSucceeded ¶
func (*Provider) EventuallyUpgradeSucceeded ¶
func (*Provider) ExpectGlooObjectNotExist ¶
func (p *Provider) ExpectGlooObjectNotExist(ctx context.Context, getter helpers.InputResourceGetter, meta *metav1.ObjectMeta)
func (*Provider) ExpectNamespaceNotExist ¶
func (*Provider) ExpectObjectAdmitted ¶
func (p *Provider) ExpectObjectAdmitted(manifest string, err error, actualOutput, expectedOutput string)
ExpectObjectAdmitted should be used when applying Policy objects that are subject to the Gloo Gateway Validation Webhook If the testInstallation has validation enabled and the manifest contains a known substring (e.g. `webhook-reject`) we expect the application to fail, with an expected error substring supplied as `expectedOutput`
func (*Provider) ExpectObjectDeleted ¶
func (*Provider) InputSnapshotContainsElement ¶ added in v1.17.5
func (p *Provider) InputSnapshotContainsElement(gvk schema.GroupVersionKind, meta metav1.ObjectMeta) func(ctx context.Context, adminClient *admincli.Client)
func (*Provider) InputSnapshotDoesNotContainElement ¶ added in v1.17.5
func (p *Provider) InputSnapshotDoesNotContainElement(gvk schema.GroupVersionKind, meta metav1.ObjectMeta) func(ctx context.Context, adminClient *admincli.Client)
func (*Provider) InputSnapshotMatches ¶ added in v1.17.5
func (*Provider) WithClusterContext ¶
WithClusterContext sets the provider to point to the provided cluster
func (*Provider) WithGlooGatewayContext ¶
func (p *Provider) WithGlooGatewayContext(ggCtx *gloogateway.Context) *Provider
WithGlooGatewayContext sets the providers to point to a particular installation of Gloo Gateway