Documentation ¶
Index ¶
- Constants
- func DeleteNS(c *kubernetes.Clientset, ns string) error
- func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
- type Framework
- func (f *Framework) AddLabelToAllNodes(name string, value string) error
- func (f *Framework) AddNamespaceToDelete(ns *v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CleanUp()
- func (f *Framework) ConfigureNodeNetwork() error
- func (f *Framework) CreateLinuxBridgeNetworkAttachmentDefinition() (*netv1.NetworkAttachmentDefinition, error)
- func (f *Framework) CreateNamespace(prefix string, labels map[string]string) (*v1.Namespace, error)
- func (f *Framework) CreateOvirtResourceMapping(ovirtMappings v2vv1.OvirtMappings) (v2vv1.ResourceMapping, error)
- func (f *Framework) CreateOvirtSecret(environment ovirtenv.Environment) (corev1.Secret, error)
- func (f *Framework) CreateOvirtSecretFromCACert() (corev1.Secret, error)
- func (f *Framework) CreateOvirtSecretInNamespace(environment ovirtenv.Environment, namespace string) (corev1.Secret, error)
- func (f *Framework) CreateOvirtSecretInNamespaceFromCACert(namespace string) (corev1.Secret, error)
- func (f *Framework) CreateVmwareResourceMapping(vmwareMappings v2vv1.VmwareMappings) (v2vv1.ResourceMapping, error)
- func (f *Framework) CreateVmwareSecret(env vmware.Environment, namespace string) (corev1.Secret, error)
- func (f *Framework) CreateVmwareSecretInNamespace(namespace string) (corev1.Secret, error)
- func (f *Framework) EnsureVMDoesNotExist(vmName string) error
- func (f *Framework) EnsureVMImportDoesNotExist(vmiName string) error
- func (f *Framework) GetAllSchedulableNodes() (*k8sv1.NodeList, error)
- func (f *Framework) GetCdiClient() (*cdi.Clientset, error)
- func (f *Framework) GetKubeClient() (*kubernetes.Clientset, error)
- func (f *Framework) GetVMImportClient() (*vmiclientset.Clientset, error)
- func (f *Framework) LoadConfig() (*rest.Config, error)
- func (f *Framework) LoadFile(fileName string) string
- func (f *Framework) LoadTemplate(fileName string, replacements map[string]string) string
- func (f *Framework) RemoveLabelFromNodes(name string) error
- func (f *Framework) WaitForDataVolumeToExist(dvName string) error
- func (f *Framework) WaitForVMImportConditionInStatus(pollInterval time.Duration, timeout time.Duration, vmiName string, ...) error
- func (f *Framework) WaitForVMToBeProcessing(vmiName string) error
- func (f *Framework) WaitForVMToExist(vmName string) (*v1.VirtualMachine, error)
Constants ¶
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 ¶
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 ¶
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
AddLabelToAllNodes adds label with given value to all schedulable nodes
func (*Framework) AddNamespaceToDelete ¶
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
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 ¶
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 ¶
CreateOvirtSecret creates ovirt secret with given environment settings
func (*Framework) CreateOvirtSecretFromCACert ¶ added in v0.2.0
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
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 (*Framework) CreateVmwareSecretInNamespace ¶ added in v0.2.2
func (*Framework) EnsureVMDoesNotExist ¶ added in v0.3.1
EnsureVMDoesNotExist blocks until VM with given name does not exist in the cluster
func (*Framework) EnsureVMImportDoesNotExist ¶ added in v0.0.4
EnsureVMImportDoesNotExist blocks until VM import with given name does not exist in the cluster
func (*Framework) GetAllSchedulableNodes ¶ added in v0.0.3
GetAllSchedulableNodes retrieves all schedulable nodes
func (*Framework) GetCdiClient ¶
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 ¶
LoadConfig loads our specified kubeconfig
func (*Framework) LoadTemplate ¶ added in v0.0.3
func (*Framework) RemoveLabelFromNodes ¶ added in v0.0.4
RemoveLabelFromNodes removes label from all schedulable nodes
func (*Framework) WaitForDataVolumeToExist ¶
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 ¶
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