Documentation
¶
Index ¶
- Constants
- func DeleteNS(c *kubernetes.Clientset, ns string) error
- func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
- type Framework
- func (f *Framework) AddNamespaceToDelete(ns *v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- 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) CreateOvirtSecret(apiUrl string, username string, password string, caCert string) (corev1.Secret, error)
- func (f *Framework) CreateOvirtSecretFromBlueprint() (corev1.Secret, error)
- func (f *Framework) CreateResourceMapping(ovirtMappings v2vv1alpha1.OvirtMappings) (v2vv1alpha1.ResourceMapping, error)
- func (f *Framework) EnsureVMIDoesNotExist(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) GetKubeVirtClient() (kubecli.KubevirtClient, 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) 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"
)
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 {
// 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
OVirtSecretName *types.NamespacedName
// KubeVirtInstallNamespace namespace where KubeVirt is installed
KubeVirtInstallNamespace 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) 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) 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) CreateOvirtSecret ¶
func (f *Framework) CreateOvirtSecret(apiUrl string, username string, password string, caCert string) (corev1.Secret, error)
CreateOvirtSecret creates ovirt secret with given credentials
func (*Framework) CreateOvirtSecretFromBlueprint ¶
CreateOvirtSecretFromBlueprint copies secret from `f.OVirtSecretName` to the test namespace
func (*Framework) CreateResourceMapping ¶ added in v0.0.3
func (f *Framework) CreateResourceMapping(ovirtMappings v2vv1alpha1.OvirtMappings) (v2vv1alpha1.ResourceMapping, error)
CreateResourceMapping creates resource mapping with given oVirt Mappings
func (*Framework) EnsureVMIDoesNotExist ¶
EnsureVMIDoesNotExist 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) GetKubeVirtClient ¶
func (f *Framework) GetKubeVirtClient() (kubecli.KubevirtClient, error)
GetVMImportClient gets an instance of a KubeVirt 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) WaitForDataVolumeToExist ¶
WaitForDataVolumeToExist blocks until Data Volume is created
func (*Framework) WaitForVMImportConditionInStatus ¶
func (f *Framework) WaitForVMImportConditionInStatus(pollInterval time.Duration, timeout time.Duration, vmiName string, conditionType v2vv1alpha1.VirtualMachineImportConditionType, status corev1.ConditionStatus, reason v2vv1alpha1.SucceededConditionReason) 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