framework

package
v0.0.0-...-246ecee Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDeployment

func CreateDeployment(kubeClient kubernetes.Interface, namespace string, d *appsv1.Deployment) error

func CreateNamespace

func CreateNamespace(kubeClient kubernetes.Interface, name string) (*v1.Namespace, error)

func CreateSubmarine

func CreateSubmarine(clientset clientset.Interface, namespace string, submarine *v1alpha1.Submarine) error

func DeleteDeployment

func DeleteDeployment(kubeClient kubernetes.Interface, namespace, name string) error

func DeleteNamespace

func DeleteNamespace(kubeClient kubernetes.Interface, name string) error

func DeleteSubmarine

func DeleteSubmarine(clientset clientset.Interface, namespace string, name string) error

func GetSubmarine

func GetSubmarine(clientset clientset.Interface, namespace string, name string) (*v1alpha1.Submarine, error)

func MakeDeployment

func MakeDeployment(pathToYaml string) (*appsv1.Deployment, error)

func MakeOperatorDeployment

func MakeOperatorDeployment() *appsv1.Deployment

func MakeSubmarineFromYaml

func MakeSubmarineFromYaml(pathToYaml string) (*v1alpha1.Submarine, error)

func PathToOSFile

func PathToOSFile(relativePath string) (*os.File, error)

PathToOSFile gets the absolute path from relative path.

func PodRunningAndReady

func PodRunningAndReady(pod corev1.Pod) (bool, error)

PodRunningAndReady returns whether a pod is running and each container has passed it's ready state.

func UpdateSubmarine

func UpdateSubmarine(clientset clientset.Interface, namespace string, submarine *v1alpha1.Submarine) error

func WaitForPodsReady

func WaitForPodsReady(kubeClient kubernetes.Interface, namespace string, timeout time.Duration, expectedReplicas int, opts metav1.ListOptions) error

WaitForPodsReady waits for a selection of Pods to be running and each container to pass its readiness check.

func WaitUntilDeploymentGone

func WaitUntilDeploymentGone(kubeClient kubernetes.Interface, namespace, name string, timeout time.Duration) error

Types

type Framework

type Framework struct {
	KubeClient      kubernetes.Interface
	SubmarineClient clientset.Interface
	Namespace       *corev1.Namespace
	OperatorPod     *corev1.Pod
	MasterHost      string
	DefaultTimeout  time.Duration
}

func New

func New(ns, kubeconfig, opImage, opImagePullPolicy string) (*Framework, error)

func (*Framework) NewTestCtx

func (f *Framework) NewTestCtx(t *testing.T) TestCtx

func (*Framework) Setup

func (f *Framework) Setup(opImage, opImagePullPolicy string) error

func (*Framework) Teardown

func (f *Framework) Teardown() error

Teardown ters down a previously initialized test environment

type TestCtx

type TestCtx struct {
	ID string
	// contains filtered or unexported fields
}

func (*TestCtx) AddFinalizerFn

func (ctx *TestCtx) AddFinalizerFn(fn finalizerFn)

func (*TestCtx) Cleanup

func (ctx *TestCtx) Cleanup(t *testing.T)

func (*TestCtx) CreateNamespace

func (ctx *TestCtx) CreateNamespace(t *testing.T, kubeClient kubernetes.Interface) string

func (*TestCtx) GetObjID

func (ctx *TestCtx) GetObjID() string

GetObjID returns an ascending ID based on the length of cleanUpFns. It is based on the premise that every new object also appends a new finalizerFn on cleanUpFns. This can e.g. be used to create multiple namespaces in the same test context.

Jump to

Keyboard shortcuts

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