e2e

package
v0.0.0-...-37f2402 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeout  = 10 * time.Minute
	PollingInterval = 250 * time.Millisecond
)
View Source
var (
	DefaultEventuallyTimeout = 5 * time.Minute
)

Functions

func CleanupK8sResource

func CleanupK8sResource[T kruntime.Object](
	ctx context.Context, client AllowedCleanUpAPIInterface[T], name string,
)

CleanupK8sResource takes a client that knows how to issue a GET and DELETE call for a given resource. It then issues a delete request then and polls the API until the resource is no longer found.

Note: If the DELETE request receives a 404 we assume the resource has been cleaned up successfully.

func CreateK8sObjectWithRetry

func CreateK8sObjectWithRetry[T kruntime.Object](
	ctx context.Context, createFunc K8sCreateFunc[T], obj T, options metav1.CreateOptions,
) (result T)

CreateK8sObjectWithRetry takes a create function like clients.Kubernetes.CoreV1().Pods(namespace).Create and the parameters for it. It then makes the call with some retry logic and returns the result after asserting there were no errors.

func DeleteK8sObjectWithRetry

func DeleteK8sObjectWithRetry(
	ctx context.Context, deleteFunc K8sDeleteFunc, name string, options metav1.DeleteOptions,
)

DeleteK8sObjectWithRetry takes a delete function like clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Delete and the parameters for it. It then makes the call with some retry logic.

func GetK8sObjectWithRetry

func GetK8sObjectWithRetry[T kruntime.Object](
	ctx context.Context, getFunc K8sGetFunc[T], name string, options metav1.GetOptions,
) (result T)

GetK8sObjectWithRetry takes a get function like clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Get and the parameters for it. It then makes the call with some retry logic and returns the result after asserting there were no errors.

func GetK8sPodLogsWithRetry

func GetK8sPodLogsWithRetry(
	ctx context.Context, namespace string, name string, options corev1.PodLogOptions,
) (rawBody string)

GetK8sPodLogsWithRetry gets the logs for the specified pod in the named namespace. It gets them with some retry logic and returns the raw string-ified body after asserting there were no errors.

func ListK8sObjectWithRetry

func ListK8sObjectWithRetry[T kruntime.Object](
	ctx context.Context, listFunc K8sListFunc[T], options metav1.ListOptions,
) (result T)

ListK8sObjectWithRetry takes a list function like clients.Kubernetes.CoreV1().Nodes().List and the parameters for it. It then makes the call with some retry logic and returns the result after asserting there were no errors.

func SaveScreenshot

func SaveScreenshot(wd selenium.WebDriver, e error)

Types

type AllowedCleanUpAPIInterface

type AllowedCleanUpAPIInterface[T kruntime.Object] interface {
	Get(ctx context.Context, name string, opts metav1.GetOptions) (T, error)
	Delete(ctx context.Context, name string, options metav1.DeleteOptions) error
}

type K8sCreateFunc

type K8sCreateFunc[T kruntime.Object] func(ctx context.Context, object T, options metav1.CreateOptions) (T, error)

type K8sDeleteFunc

type K8sDeleteFunc func(ctx context.Context, name string, options metav1.DeleteOptions) error

type K8sGetFunc

type K8sGetFunc[T kruntime.Object] func(ctx context.Context, name string, options metav1.GetOptions) (T, error)

type K8sListFunc

type K8sListFunc[T kruntime.Object] func(ctx context.Context, options metav1.ListOptions) (T, error)

type Project

type Project struct {
	Name string
	// contains filtered or unexported fields
}

func BuildNewProject

func BuildNewProject(
	ctx context.Context, cli kubernetes.Interface, projectClient projectclient.Interface, name string,
) Project

func (Project) CleanUp

func (p Project) CleanUp(ctx context.Context)

func (Project) Delete

func (p Project) Delete(ctx context.Context)

func (Project) VerifyProjectIsDeleted

func (p Project) VerifyProjectIsDeleted(ctx context.Context)

VerifyProjectIsDeleted verifies that the project does not exist by polling it.

func (Project) VerifyProjectIsReady

func (p Project) VerifyProjectIsReady(ctx context.Context) error

VerifyProjectIsReady verifies that the project and relevant resources have been created correctly and returns an error if any.

Jump to

Keyboard shortcuts

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