e2e

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestContainerSleepInf *corev1.Container = &corev1.Container{
		Name: testContainerNamePrefix + "sleep-inf",
		Args: []string{"sleep", "inf"},

		Image: "krallin/ubuntu-tini:trusty",
	}
	TestSidecarContainerEcho *corev1.Container = &corev1.Container{
		Name: testSidecarContainerNamePrefix + "echo",

		Command: []string{"sh", "-c", "sleep 10; echo sidecar"},
		Image:   "alpine",
	}
	TestSidecarContainerExit1 *corev1.Container = &corev1.Container{
		Name: testSidecarContainerNamePrefix + "exit1",

		Command: []string{"sh", "-c", "sleep 10; exit 1"},
		Image:   "alpine",
	}
	TestFinalizerContainerEcho *corev1.Container = &corev1.Container{
		Name: testFinalizerContainerNamePrefix + "echo",

		Command: []string{"sh", "-c", "sleep 10; echo finalizer"},
		Image:   "alpine",
	}

	TestDefaultPod *corev1.Pod = &corev1.Pod{
		TypeMeta: metav1.TypeMeta{
			APIVersion: corev1.SchemeGroupVersion.String(),
			Kind:       "Pod",
		},
		Spec: corev1.PodSpec{
			Containers: []corev1.Container{*TestContainerSleepInf.DeepCopy()},
		},
	}
	TestDefaultFluentPVC *fluentpvcv1alpha1.FluentPVC = &fluentpvcv1alpha1.FluentPVC{
		TypeMeta: metav1.TypeMeta{
			APIVersion: fluentpvcv1alpha1.GroupVersion.String(),
			Kind:       "FluentPVC",
		},
		Spec: fluentpvcv1alpha1.FluentPVCSpec{
			PVCSpecTemplate: corev1.PersistentVolumeClaimSpec{
				AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
				Resources: corev1.ResourceRequirements{
					Requests: map[corev1.ResourceName]resource.Quantity{
						corev1.ResourceStorage: resource.MustParse("1Gi"),
					},
				},
				StorageClassName: func(s string) *string { return &s }("standard"),
			},
			PVCVolumeName:            "test-volume",
			PVCVolumeMountPath:       "/mnt/test",
			CommonEnvs:               []corev1.EnvVar{},
			SidecarContainerTemplate: *TestSidecarContainerEcho.DeepCopy(),
			DeletePodIfSidecarContainerTerminationDetected: true,
			PVCFinalizerJobSpecTemplate: batchv1.JobSpec{
				BackoffLimit: pointer.Int32Ptr(0),
				Template: corev1.PodTemplateSpec{
					Spec: corev1.PodSpec{
						RestartPolicy: corev1.RestartPolicyNever,
						Containers: []corev1.Container{
							*TestFinalizerContainerEcho.DeepCopy(),
						},
					},
				},
			},
		},
	}
)

Functions

func ConsistentlyPodRunning

func ConsistentlyPodRunning(c client.Client, ctx context.Context, namespace, name string) AsyncAssertion

func EventuallyPodContainerRestart

func EventuallyPodContainerRestart(c client.Client, ctx context.Context, namespace, name string) AsyncAssertion

func EventuallyPodDeleted

func EventuallyPodDeleted(c client.Client, ctx context.Context, namespace, name string) AsyncAssertion

func EventuallyPodRunning

func EventuallyPodRunning(c client.Client, ctx context.Context, namespace, name string) AsyncAssertion

func GinkgoNodeId

func GinkgoNodeId() string

func RandomString

func RandomString() string

Types

type TestK8SClient

type TestK8SClient struct {
	client.Client
}

func NewTestK8SClient

func NewTestK8SClient(c client.Client) *TestK8SClient

func (*TestK8SClient) DeleteAllInNamespace

func (c *TestK8SClient) DeleteAllInNamespace(ctx context.Context, namespace string, obj client.Object)

func (*TestK8SClient) DeleteFluentPVC

func (c *TestK8SClient) DeleteFluentPVC(ctx context.Context, name string)

func (*TestK8SClient) DeleteNamespace

func (c *TestK8SClient) DeleteNamespace(ctx context.Context, name string)

func (*TestK8SClient) Find

func (c *TestK8SClient) Find(ctx context.Context, obj client.Object)

func (*TestK8SClient) FindOrCreate

func (c *TestK8SClient) FindOrCreate(ctx context.Context, obj client.Object, opts ...client.CreateOption)

Jump to

Keyboard shortcuts

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