framework

package
v0.0.0-...-d0e3930 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Framework

type Framework struct {
	KubeClient   kubernetes.Interface
	Namespace    string
	NodeName     string
	WatchTimeout time.Duration
}

Framework encapsulates the configuration for the current run, and provides helper methods to be used during testing.

func NewTestingFramework

func NewTestingFramework(kubeconfig, namespace, nodeName string, watchTimeout time.Duration) *Framework

NewTestingFramework returns a new instance of the testing framework.

func (*Framework) CreateDummyPodObjectWithPrefix

func (f *Framework) CreateDummyPodObjectWithPrefix(testName string, prefix string, images ...string) *corev1.Pod

CreateDummyPodObjectWithPrefix creates a dujmmy pod object using the specified prefix as the value of .metadata.generateName. A variable number of strings can be provided. For each one of these strings, a container that uses the string as its image will be appended to the pod. This method DOES NOT create the pod in the Kubernetes API.

func (*Framework) CreatePod

func (f *Framework) CreatePod(ctx context.Context, pod *corev1.Pod) (*corev1.Pod, error)

CreatePod creates the specified pod in the Kubernetes API.

func (*Framework) CreatePodObjectWithEnv

func (f *Framework) CreatePodObjectWithEnv(testName string, env []corev1.EnvVar) *corev1.Pod

CreatePodObjectWithEnv creates a pod object whose name starts with "env-test-" and that uses the specified environment configuration for its first container.

func (*Framework) CreatePodObjectWithMandatoryConfigMapKey

func (f *Framework) CreatePodObjectWithMandatoryConfigMapKey(testName string) *corev1.Pod

CreatePodObjectWithMandatoryConfigMapKey creates a pod object that references the "key_0" key from the "config-map-0" config map as mandatory.

func (*Framework) CreatePodObjectWithMandatorySecretKey

func (f *Framework) CreatePodObjectWithMandatorySecretKey(testName string) *corev1.Pod

CreatePodObjectWithMandatorySecretKey creates a pod object that references the "key_0" key from the "secret-0" config map as mandatory.

func (*Framework) CreatePodObjectWithOptionalConfigMapKey

func (f *Framework) CreatePodObjectWithOptionalConfigMapKey(testName string) *corev1.Pod

CreatePodObjectWithOptionalConfigMapKey creates a pod object that references the "key_0" key from the "config-map-0" config map as optional.

func (*Framework) CreatePodObjectWithOptionalSecretKey

func (f *Framework) CreatePodObjectWithOptionalSecretKey(testName string) *corev1.Pod

CreatePodObjectWithOptionalSecretKey creates a pod object that references the "key_0" key from the "secret-0" config map as optional.

func (*Framework) DeleteNode

func (f *Framework) DeleteNode(ctx context.Context) error

DeleteNode deletes the vk node used by the framework

func (*Framework) DeletePod

func (f *Framework) DeletePod(ctx context.Context, namespace, name string) error

DeletePod deletes the pod with the specified name and namespace in the Kubernetes API using the default grace period.

func (*Framework) DeletePodImmediately

func (f *Framework) DeletePodImmediately(ctx context.Context, namespace, name string) error

DeletePodImmediately forcibly deletes the pod with the specified name and namespace in the Kubernetes API. This is equivalent to running "kubectl delete --force --grace-period 0 --namespace <namespace> pod <name>".

func (*Framework) GetNode

func (f *Framework) GetNode(ctx context.Context) (*corev1.Node, error)

GetNode gets the vk nodeused by the framework

func (*Framework) GetRunningPodsFromKubernetes

func (f *Framework) GetRunningPodsFromKubernetes(ctx context.Context) (*corev1.PodList, error)

GetRunningPodsFromKubernetes gets the running pods from the provider of the virtual kubelet

func (*Framework) GetRunningPodsFromProvider

func (f *Framework) GetRunningPodsFromProvider(ctx context.Context) (*corev1.PodList, error)

GetRunningPodsFromProvider gets the running pods from the provider of the virtual kubelet

func (*Framework) GetStatsSummary

func (f *Framework) GetStatsSummary(ctx context.Context) (*stats.Summary, error)

GetStatsSummary queries the /stats/summary endpoint of the virtual-kubelet and returns the Summary object obtained as a response.

func (*Framework) WaitUntilNodeCondition

func (f *Framework) WaitUntilNodeCondition(fn watch.ConditionFunc) error

WaitUntilNodeCondition establishes a watch on the vk node. Then, it waits for the specified condition function to be verified.

func (*Framework) WaitUntilPodCondition

func (f *Framework) WaitUntilPodCondition(namespace, name string, fn watch.ConditionFunc) (*corev1.Pod, error)

WaitUntilPodCondition establishes a watch on the pod with the specified name and namespace. Then, it waits for the specified condition function to be verified.

func (*Framework) WaitUntilPodDeleted

func (f *Framework) WaitUntilPodDeleted(namespace, name string) (*corev1.Pod, error)

WaitUntilPodDeleted blocks until the pod with the specified name and namespace is deleted from apiserver.

func (*Framework) WaitUntilPodEventWithReason

func (f *Framework) WaitUntilPodEventWithReason(pod *corev1.Pod, reason string) error

WaitUntilPodEventWithReason establishes a watch on events involving the specified pod. Then, it waits for an event with the specified reason to be created/updated.

func (*Framework) WaitUntilPodInPhase

func (f *Framework) WaitUntilPodInPhase(namespace, name string, phases ...corev1.PodPhase) (*corev1.Pod, error)

WaitUntilPodInPhase blocks until the pod with the specified name and namespace is in one of the specified phases

func (*Framework) WaitUntilPodReady

func (f *Framework) WaitUntilPodReady(namespace, name string) (*corev1.Pod, error)

WaitUntilPodReady blocks until the pod with the specified name and namespace is reported to be running and ready.

Jump to

Keyboard shortcuts

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