framework

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: Apache-2.0 Imports: 33 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"
)

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

func NewFramework(prefix 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 string) *Framework

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

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) 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) 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

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

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

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

EnsureVMIDoesNotExist 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) 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

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) 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 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

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