framework

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//NsPrefixLabel provides a virtual machine import prefix label to identify the test namespace
	NsPrefixLabel  = "vm-import-e2e"
	ProviderOvirt  = "ovirt"
	ProviderVmware = "vmware"
)

Variables

This section is empty.

Functions

func DeleteNS

func DeleteNS(c *kubernetes.Clientset, ns string) error

DeleteNS provides a function to delete the specified namespace from the test cluster

func GetKubeClientFromRESTConfig

func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)

GetKubeClientFromRESTConfig provides a function to get a K8s client using the REST config

Types

type Framework

type Framework struct {
	// Client is a controller-runtime client.
	Client rclient.Client
	// NsPrefix is a prefix for generated namespace
	NsPrefix string
	//  k8sClient provides our k8s client pointer
	K8sClient *kubernetes.Clientset
	// VMImportClient provides Virtual Machine Import client pointer
	VMImportClient *vmiclientset.Clientset
	// KubeVirtClient provides KubeVirt client pointer
	//KubeVirtClient kubecli.KubevirtClient
	// CdiClient provides our CDI client pointer
	CdiClient *cdi.Clientset
	// RestConfig provides a pointer to our REST client config.
	RestConfig *rest.Config
	// OvirtStubbingClient provides a way to stub oVirt behavior
	OvirtStubbingClient *sclient.FakeOvirtClient
	// Namespace provides a namespace for each test generated/unique ns per test
	Namespace *v1.Namespace

	// KubectlPath is a test run-time flag so we can find kubectl
	KubectlPath string
	// KubeConfig is a test run-time flag to store the location of our test setup kubeconfig
	KubeConfig string
	// Master is a test run-time flag to store the id of our master node
	Master string
	// The namespaced name of the oVirt secret to copy for tests
	OVirtCA string
	// KubeVirtInstallNamespace namespace where KubeVirt is installed
	KubeVirtInstallNamespace string

	// DefaultStorageClass specifies the name of a basic, default storage class
	DefaultStorageClass string
	// NfsStorageClass specifies the name of an NFS-based storage class
	NfsStorageClass string

	// ImageioInstallNamespace namespace where ImageIO and FakeOvirt are installed
	ImageioInstallNamespace string

	// VcsimInstallNamespace namespace where the vcsim container is installed
	VcsimInstallNamespace string

	Provider string
	// contains filtered or unexported fields
}

This package is based on https://github.com/kubevirt/containerized-data-importer/blob/master/tests/framework/framework.go Framework supports common operations used by functional/e2e tests.

func NewFramework

func NewFramework(prefix, provider string) (*Framework, error)

NewFramework makes a new framework and sets up the global BeforeEach/AfterEach's. Test run-time flags are parsed and added to the Framework struct.

func NewFrameworkOrDie

func NewFrameworkOrDie(prefix, provider string) *Framework

NewFrameworkOrDie calls NewFramework and handles errors by calling Fail. Config is optional, but if passed there can only be one.

func (*Framework) AddLabelToAllNodes added in v0.0.4

func (f *Framework) AddLabelToAllNodes(name string, value string) error

AddLabelToAllNodes adds label with given value to all schedulable nodes

func (*Framework) AddNamespaceToDelete

func (f *Framework) AddNamespaceToDelete(ns *v1.Namespace)

AddNamespaceToDelete provides a wrapper around the go append function

func (*Framework) AfterEach

func (f *Framework) AfterEach()

AfterEach provides a set of operations to run after each test

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach provides a set of operations to run before each test

func (*Framework) CleanUp added in v0.0.4

func (f *Framework) CleanUp()

CleanUp provides a set of operations clean the namespace

func (*Framework) ConfigureNodeNetwork added in v0.0.3

func (f *Framework) ConfigureNodeNetwork() error

Tests in Multus suite are expecting a Linux bridge to be available on each node, with iptables allowing traffic to go through. This function creates a Daemon Set on the cluster (if not exists yet), this Daemon Set creates a linux bridge and configures the firewall. We use iptables-compat in order to work with both iptables and newer nftables. Based on https://github.com/kubevirt/kubevirt/blob/master/tests/vmi_multus_test.go

func (*Framework) CreateLinuxBridgeNetworkAttachmentDefinition added in v0.0.3

func (f *Framework) CreateLinuxBridgeNetworkAttachmentDefinition() (*netv1.NetworkAttachmentDefinition, error)

CreateLinuxBridgeNetworkAttachmentDefinition creates Linux Bridge network attachment

func (*Framework) CreateNamespace

func (f *Framework) CreateNamespace(prefix string, labels map[string]string) (*v1.Namespace, error)

CreateNamespace instantiates a new namespace object with a unique name and the passed-in label(s).

func (*Framework) CreateOvirtResourceMapping added in v0.2.4

func (f *Framework) CreateOvirtResourceMapping(ovirtMappings v2vv1.OvirtMappings) (v2vv1.ResourceMapping, error)

CreateOvirtResourceMapping creates resource mapping with given oVirt Mappings

func (*Framework) CreateOvirtSecret

func (f *Framework) CreateOvirtSecret(environment ovirtenv.Environment) (corev1.Secret, error)

CreateOvirtSecret creates ovirt secret with given environment settings

func (*Framework) CreateOvirtSecretFromCACert added in v0.2.0

func (f *Framework) CreateOvirtSecretFromCACert() (corev1.Secret, error)

CreateOvirtSecretFromCACert creates Ovirt secret

func (*Framework) CreateOvirtSecretInNamespace added in v0.2.0

func (f *Framework) CreateOvirtSecretInNamespace(environment ovirtenv.Environment, namespace string) (corev1.Secret, error)

CreateOvirtSecretInNamespace creates ovirt secret with given environment settings in given namespace

func (*Framework) CreateOvirtSecretInNamespaceFromCACert added in v0.2.0

func (f *Framework) CreateOvirtSecretInNamespaceFromCACert(namespace string) (corev1.Secret, error)

CreateOvirtSecretInNamespaceFromCACert creates Ovirt secret in given namespace

func (*Framework) CreateVmwareResourceMapping added in v0.2.4

func (f *Framework) CreateVmwareResourceMapping(vmwareMappings v2vv1.VmwareMappings) (v2vv1.ResourceMapping, error)

CreateVmwareResourceMapping creates resource mapping with given VmwareMappings

func (*Framework) CreateVmwareSecret added in v0.2.2

func (f *Framework) CreateVmwareSecret(env vmware.Environment, namespace string) (corev1.Secret, error)

func (*Framework) CreateVmwareSecretInNamespace added in v0.2.2

func (f *Framework) CreateVmwareSecretInNamespace(namespace string) (corev1.Secret, error)

func (*Framework) EnsureVMDoesNotExist added in v0.3.1

func (f *Framework) EnsureVMDoesNotExist(vmName string) error

EnsureVMDoesNotExist blocks until VM with given name does not exist in the cluster

func (*Framework) EnsureVMImportDoesNotExist added in v0.0.4

func (f *Framework) EnsureVMImportDoesNotExist(vmiName string) error

EnsureVMImportDoesNotExist blocks until VM import with given name does not exist in the cluster

func (*Framework) GetAllSchedulableNodes added in v0.0.3

func (f *Framework) GetAllSchedulableNodes() (*k8sv1.NodeList, error)

GetAllSchedulableNodes retrieves all schedulable nodes

func (*Framework) GetCdiClient

func (f *Framework) GetCdiClient() (*cdi.Clientset, error)

GetCdiClient gets an instance of a kubernetes client that includes all the CDI extensions.

func (*Framework) GetKubeClient

func (f *Framework) GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient returns a Kubernetes rest client

func (*Framework) GetVMImportClient

func (f *Framework) GetVMImportClient() (*vmiclientset.Clientset, error)

GetVMImportClient gets an instance of a Virtual Machine Import client

func (*Framework) LoadConfig

func (f *Framework) LoadConfig() (*rest.Config, error)

LoadConfig loads our specified kubeconfig

func (*Framework) LoadFile added in v0.0.3

func (f *Framework) LoadFile(fileName string) string

func (*Framework) LoadTemplate added in v0.0.3

func (f *Framework) LoadTemplate(fileName string, replacements map[string]string) string

func (*Framework) RemoveLabelFromNodes added in v0.0.4

func (f *Framework) RemoveLabelFromNodes(name string) error

RemoveLabelFromNodes removes label from all schedulable nodes

func (*Framework) WaitForDataVolumeToExist

func (f *Framework) WaitForDataVolumeToExist(dvName string) error

WaitForDataVolumeToExist blocks until Data Volume is created

func (*Framework) WaitForVMImportConditionInStatus

func (f *Framework) WaitForVMImportConditionInStatus(pollInterval time.Duration, timeout time.Duration, vmiName string, conditionType v2vv1.VirtualMachineImportConditionType, status corev1.ConditionStatus, reason string, namespace string) error

WaitForVMImportConditionInStatus blocks until VM import with given name has given status condition with given status

func (*Framework) WaitForVMToBeProcessing

func (f *Framework) WaitForVMToBeProcessing(vmiName string) error

WaitForVMToBeProcessing blocks until VM import with given name is in Processing state

func (*Framework) WaitForVMToExist

func (f *Framework) WaitForVMToExist(vmName string) (*v1.VirtualMachine, error)

WaitForVMToExist blocks until VM is created

Jump to

Keyboard shortcuts

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