assertions

package
v1.17.0-beta23 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README

Assertion

A ClusterAssertion is a function which asserts a given behavior of a cluster, at a point in time.

If you intend to introduce a new assertion, please follow this approach:

  • We want to avoid writing generic assertions, that are specific to certain tests. Assertions should contain no custom logic, and instead support dependency injection.
  • If you are unsure if an assertion is generic, start by adding it directly to your test, and then you can make it more generic in a follow-up.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterAssertion

type ClusterAssertion func(ctx context.Context)

ClusterAssertion is a function which asserts a given behavior at a point in time If it succeeds, it will not return anything If it fails, it must panic We typically rely on the onsi.Gomega library to implement these assertions

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the entity that creates a ClusterAssertion These assertions occur against a running instance of Gloo Gateway, within a Kubernetes Cluster. So this provider maintains state about the install/cluster it is using, and then provides operations.ClusterAssertion to match

func NewProvider

func NewProvider() *Provider

NewProvider returns a Provider that will provide Assertions that can be executed against an installation of Gloo Gateway

func (*Provider) CheckResources

func (p *Provider) CheckResources() ClusterAssertion

CheckResources returns the ClusterAssertion that performs a `glooctl check`

func (*Provider) CurlFnEventuallyResponds

func (p *Provider) CurlFnEventuallyResponds(curlFn func() string, expectedResponse *matchers.HttpResponse, timeout ...time.Duration) ClusterAssertion

CurlFnEventuallyResponds returns a ClusterAssertion that behaves similarly to EphemeralCurlEventuallyResponds The difference is that it accepts a generic function to execute the curl, instead of requiring the caller to pass explicit curl.Option Not all curl requests should be done from an ephemeral container, and this function allows for that to occur

func (*Provider) EnvoyAdminApiAssertion

func (p *Provider) EnvoyAdminApiAssertion(
	envoyDeployment metav1.ObjectMeta,
	adminAssertion func(ctx context.Context, adminClient *admincli.Client),
) ClusterAssertion

func (*Provider) EphemeralCurlEventuallyResponds

func (p *Provider) EphemeralCurlEventuallyResponds(curlPod client.Object, curlOptions []curl.Option, expectedResponse *matchers.HttpResponse, timeout ...time.Duration) ClusterAssertion

EphemeralCurlEventuallyResponds returns a ClusterAssertion to assert that a set of curl.Option will return the expected matchers.HttpResponse This implementation relies on executing from an ephemeral container. It is the caller's responsibility to ensure the curlPodMeta points to a pod that is alive and ready to accept traffic

func (*Provider) InstallationWasSuccessful

func (p *Provider) InstallationWasSuccessful() ClusterAssertion

func (*Provider) NamespaceNotExist

func (p *Provider) NamespaceNotExist(ns string) ClusterAssertion

func (*Provider) ObjectsExist

func (p *Provider) ObjectsExist(objects ...client.Object) ClusterAssertion

func (*Provider) ObjectsNotExist

func (p *Provider) ObjectsNotExist(objects ...client.Object) ClusterAssertion

func (*Provider) RunningReplicas

func (p *Provider) RunningReplicas(deploymentMeta metav1.ObjectMeta, replicaMatcher types.GomegaMatcher) ClusterAssertion

func (*Provider) UninstallationWasSuccessful

func (p *Provider) UninstallationWasSuccessful() ClusterAssertion

func (*Provider) WithClusterContext

func (p *Provider) WithClusterContext(clusterContext *cluster.Context) *Provider

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

func (*Provider) WithProgressWriter

func (p *Provider) WithProgressWriter(progressWriter io.Writer) *Provider

WithProgressWriter sets the io.Writer for the provider

Jump to

Keyboard shortcuts

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