tests

package
v0.36.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 81 Imported by: 1

README

Integration tests

Writing e2e tests

We aim to run e2e tests in parallel by default. As such the following rules should be followed:

  • Use cirros and alpine VMs for testing wherever possible. If you have to use use another OS, discuss on the PR why it is needed.
  • Stay within the boundary of the testnamespaces which we prove. If you have to create resources outside of the test namespaces, discuss potential solutions on such a PR.
  • If you really have to run tests serial (destructive tests, infra-tests, ...), mark the test with a [Serial] tag.
  • If tests are not using the default cleanup code, additional custom preparations may be necessary.

The following types of tests need to be marked as [Serial] right now:

  • Tests which use PVCs or DataVolumes (parallelizing these is on the way).
  • Tests which use BeforeAll.

Additional suggestions:

  • The [Disruptive] tag is recognized by the test suite but is not yet mandatory. Feel free to set it on destructive tests.
  • Conformance tests need to be marked with a [Conformance] tag.

Test Namespaces

If tests are executed in parallel, every test gets its unique set of namespaces to test in. If you write a test and reference the namespaces test.NamespaceTestDefault, test.NamespaceTestAlternative or tests.NamespaceTestOperator, you get different values, based on the ginkgo execution node.

For as long as test resources are created by referencing these namespaces, there is no test conflict to expect.

Running integration tests

Integration tests require a running Kubevirt cluster. Once you have a running Kubevirt cluster, you can use the -master and the -kubeconfig flags to point the tests to the cluster.

Run them on an arbitrary KubeVirt installation

cd tests # from the git repo root folder
go test -kubeconfig=path/to/my/config -config=default-config.json

Run them on one of the core KubeVirt providers

There is a make target to run this with the config taken from hack/config.sh:

# from the git repo root folder
make functest

Run them anywhere inside of container

# Create directory for data / results / kubectl binary
mkdir -p /tmp/kubevirt-tests-data
# Make sure that eveybody can write there
setfacl -m d:o:rwx /tmp/kubevirt-tests-data
setfacl -m o:rwx /tmp/kubevirt-tests-data

docker run \
    -v /tmp/kubevirt-tests-data:/home/kubevirt-tests/data:rw,z --rm \
    kubevirt/tests:latest \
        --kubeconfig=data/openshift-master.kubeconfig \
        --container-tag=latest \
        --container-prefix=docker.io/kubevirt \
        --test.timeout 180m \
        --junit-output=data/results/junit.xml \
        --deploy-testing-infra \
        --path-to-testing-infra-manifests=data/manifests

Documentation

Index

Constants

View Source
const (
	JobRetry   = 3
	JobTTL     = 60
	JobTimeout = 480
)

Default Job arguments to be used with NewJob.

View Source
const (
	AlpineHttpUrl = iota
	GuestAgentHttpUrl
	PixmanUrl
	StressHttpUrl
	DmidecodeHttpUrl
	DummyFileHttpUrl
	CirrosHttpUrl
	VirtWhatCpuidHelperHttpUrl
)
View Source
const (
	SubresourceServiceAccountName = "kubevirt-subresource-test-sa"
	AdminServiceAccountName       = "kubevirt-admin-test-sa"
	EditServiceAccountName        = "kubevirt-edit-test-sa"
	ViewServiceAccountName        = "kubevirt-view-test-sa"
)
View Source
const (
	NFSTargetName   = "test-nfs-target"
	ISCSITargetName = "test-isci-target"
)
View Source
const (
	HostPathBase   = "/tmp/hostImages/"
	HostPathAlpine = HostPathBase + "alpine"
	HostPathCustom = HostPathBase + "custom"
)
View Source
const (
	DiskAlpineHostPath = "disk-alpine-host-path"
	DiskWindows        = "disk-windows"
	DiskRhel           = "disk-rhel"
	DiskCustomHostPath = "disk-custom-host-path"
)
View Source
const (
	TCPServer  = server("\"Hello World!\"\n")
	HTTPServer = server("\"HTTP/1.1 200 OK\\nContent-Length: 12\\n\\nHello World!\"\n")
)
View Source
const (
	// BlockDiskForTest contains name of the block PV and PVC
	BlockDiskForTest = "block-disk-for-tests"
)
View Source
const (
	CustomHostPath = "custom-host-path"
)
View Source
const (
	SecretLabel = "kubevirt.io/secret"
)
View Source
const SubresourceTestLabel = "subresource-access-test-pod"
View Source
const TempDirPrefix = "kubevirt-test"
View Source
const VMIResource = "virtualmachineinstances"

Variables

View Source
var CDIInsecureRegistryConfig *k8sv1.ConfigMap
View Source
var KubeVirtDefaultConfig v1.KubeVirtConfiguration
View Source
var NamespaceTestAlternative = "kubevirt-test-alternative"

NamespaceTestAlternative is used to test controller-namespace independency.

View Source
var NamespaceTestDefault = "kubevirt-test-default"

tests.NamespaceTestDefault is the default namespace, to test non-infrastructure related KubeVirt objects.

View Source
var NamespaceTestOperator = "kubevirt-test-operator"

NamespaceTestOperator is used to test if namespaces can still be deleted when kubevirt is uninstalled

Functions

func AddBootOrderToDisk added in v0.6.0

func AddBootOrderToDisk(vmi *v1.VirtualMachineInstance, diskName string, bootorder *uint) *v1.VirtualMachineInstance

func AddCloudInitConfigDriveData added in v0.19.0

func AddCloudInitConfigDriveData(vmi *v1.VirtualMachineInstance, name, userData, networkData string, b64encode bool)

func AddCloudInitNoCloudData added in v0.19.0

func AddCloudInitNoCloudData(vmi *v1.VirtualMachineInstance, name, userData, networkData string, b64encode bool)

func AddConfigMapDisk added in v0.9.0

func AddConfigMapDisk(vmi *v1.VirtualMachineInstance, configMapName string, volumeName string)

func AddConfigMapDiskWithCustomLabel added in v0.29.0

func AddConfigMapDiskWithCustomLabel(vmi *v1.VirtualMachineInstance, configMapName string, volumeName string, volumeLabel string)

func AddEphemeralCdrom added in v0.12.0

func AddEphemeralCdrom(vmi *v1.VirtualMachineInstance, name string, bus string, image string) *v1.VirtualMachineInstance

func AddEphemeralDisk added in v0.3.0

func AddEphemeralDisk(vmi *v1.VirtualMachineInstance, name string, bus string, image string) *v1.VirtualMachineInstance

func AddExplicitPodNetworkInterface added in v0.7.0

func AddExplicitPodNetworkInterface(vmi *v1.VirtualMachineInstance)

func AddHostDisk added in v0.9.4

func AddHostDisk(vmi *v1.VirtualMachineInstance, path string, diskType v1.HostDiskType, name string)

func AddLabelDownwardAPIVolume added in v0.35.0

func AddLabelDownwardAPIVolume(vmi *v1.VirtualMachineInstance, volumeName string)

func AddLabelToNode added in v0.16.0

func AddLabelToNode(nodeName string, key string, value string)

func AddPVCDisk added in v0.5.0

func AddPVCDisk(vmi *v1.VirtualMachineInstance, name string, bus string, claimName string) *v1.VirtualMachineInstance

func AddPVCFS added in v0.34.0

func AddPVCFS(vmi *v1.VirtualMachineInstance, name string, claimName string) *v1.VirtualMachineInstance

func AddSecretDisk added in v0.9.0

func AddSecretDisk(vmi *v1.VirtualMachineInstance, secretName string, volumeName string)

func AddSecretDiskWithCustomLabel added in v0.29.0

func AddSecretDiskWithCustomLabel(vmi *v1.VirtualMachineInstance, secretName string, volumeName string, volumeLabel string)

func AddServiceAccountDisk added in v0.9.2

func AddServiceAccountDisk(vmi *v1.VirtualMachineInstance, serviceAccountName string)

func AddUserData added in v0.9.0

func AddUserData(vmi *v1.VirtualMachineInstance, name string, userData string)

func AdjustKubeVirtResource added in v0.29.0

func AdjustKubeVirtResource()

func AfterTestSuitCleanup

func AfterTestSuitCleanup()

func AppendEmptyDisk added in v0.16.0

func AppendEmptyDisk(vmi *v1.VirtualMachineInstance, diskName, busName, diskSize string)

func ApplyRawManifest added in v0.12.0

func ApplyRawManifest(object unstructured.Unstructured) error

func BeforeAll added in v0.4.1

func BeforeAll(fn func())

func BeforeTestCleanup

func BeforeTestCleanup()

func BeforeTestSuitSetup

func BeforeTestSuitSetup(_ []byte)

func CalculateNamespaces added in v0.34.0

func CalculateNamespaces()

CalculateNamespaces checks on which ginkgo gest node the tests are run and sets the namespaces accordingly

func CallUrlOnPod added in v0.30.5

func CallUrlOnPod(pod *k8sv1.Pod, port string, url string) ([]byte, error)

func CleanNodes added in v0.16.0

func CleanNodes()

func ConfirmVMIPostMigration added in v0.35.0

func ConfirmVMIPostMigration(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, migrationUID string)

func ContainsCrt added in v0.29.0

func ContainsCrt(bundle []byte, containedCrt []byte) bool

func CreateBlockVolumePvAndPvc added in v0.9.2

func CreateBlockVolumePvAndPvc(size string)

func CreateCommandWithNS added in v0.9.5

func CreateCommandWithNS(namespace string, cmdName string, args ...string) (string, *exec.Cmd, error)

func CreateConfigMap added in v0.9.0

func CreateConfigMap(name string, data map[string]string)

func CreateHostDiskImage added in v0.9.0

func CreateHostDiskImage(diskPath string) *k8sv1.Pod

func CreateHostPathPVC added in v0.11.0

func CreateHostPathPVC(os, size string)

func CreateHostPathPv added in v0.6.1

func CreateHostPathPv(osName string, hostPath string)

func CreateHostPathPvWithSize added in v0.9.6

func CreateHostPathPvWithSize(osName string, hostPath string, size string)

func CreateISCSIPvAndPvc added in v0.12.0

func CreateISCSIPvAndPvc(name string, size string, iscsiTargetIP string, accessMode k8sv1.PersistentVolumeAccessMode, volumeMode k8sv1.PersistentVolumeMode)

func CreateISCSITargetPOD added in v0.12.0

func CreateISCSITargetPOD(containerDiskName cd.ContainerDisk) *k8sv1.Pod

func CreateNFSPvAndPvc added in v0.19.0

func CreateNFSPvAndPvc(name string, size string, nfsTargetIP string, os string)

func CreateNFSTargetPOD added in v0.19.0

func CreateNFSTargetPOD(os string) *k8sv1.Pod

func CreatePVC added in v0.5.0

func CreatePVC(os, size, storageClass string)

func CreatePodAndWaitUntil added in v0.34.0

func CreatePodAndWaitUntil(pod *corev1.Pod, phaseToWait corev1.PodPhase) *corev1.Pod

func CreateSecret added in v0.9.0

func CreateSecret(name string, data map[string]string)

func DeleteConfigMap added in v0.9.0

func DeleteConfigMap(name string)

func DeletePV added in v0.5.0

func DeletePV(os string)

func DeletePVC added in v0.5.0

func DeletePVC(os string)

func DeletePvAndPvc added in v0.9.2

func DeletePvAndPvc(name string)

func DeleteRawManifest added in v0.12.0

func DeleteRawManifest(object unstructured.Unstructured) error

func DeleteSecret added in v0.9.0

func DeleteSecret(name string)

func DeployTestingInfrastructure added in v0.12.0

func DeployTestingInfrastructure()

func DetectLatestUpstreamOfficialTag added in v0.31.0

func DetectLatestUpstreamOfficialTag() (string, error)

func DisableFeatureGate added in v0.20.0

func DisableFeatureGate(feature string)

func DoScaleDeployment added in v0.12.0

func DoScaleDeployment(namespace string, name string, desired int32) (error, int32)

Do scale and returns error, replicas-before.

func DoScaleVirtHandler added in v0.12.0

func DoScaleVirtHandler(namespace string, name string, selector map[string]string) (int32, map[string]string, int64, error)

func EnableFeatureGate added in v0.20.0

func EnableFeatureGate(feature string) *v1.KubeVirt

func EncodePrivateKeyToPEM added in v0.19.0

func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte

EncodePrivateKeyToPEM encodes Private Key from RSA to PEM format

func EnsureKVMPresent added in v0.7.0

func EnsureKVMPresent()

func EnsurePodsCertIsSynced added in v0.29.0

func EnsurePodsCertIsSynced(labelSelector string, namespace string, port string) []byte

EnsurePodsCertIsSynced waits until new certificates are rolled out to all pods which are matching the specified labelselector. Once all certificates are in sync, the final secret is returned

func ExecuteCommandOnPod added in v0.4.1

func ExecuteCommandOnPod(virtCli kubecli.KubevirtClient, pod *k8sv1.Pod, containerName string, command []string) (string, error)

func ExecuteCommandOnPodV2 added in v0.9.0

func ExecuteCommandOnPodV2(virtCli kubecli.KubevirtClient, pod *k8sv1.Pod, containerName string, command []string) (stdout, stderr string, err error)

func ExpectMigrationSuccess added in v0.36.3

func ExpectMigrationSuccess(virtClient kubecli.KubevirtClient, migration *v1.VirtualMachineInstanceMigration, timeout int) string

func ExpectResourceVersionToBeEqualConfigVersion added in v0.35.0

func ExpectResourceVersionToBeEqualConfigVersion(resourceVersion, configVersion string) bool

func ExpectResourceVersionToBeLessThanConfigVersion added in v0.35.0

func ExpectResourceVersionToBeLessThanConfigVersion(resourceVersion, configVersion string) bool

func FormatIPForURL added in v0.29.0

func FormatIPForURL(ip string) string

func ForwardPorts added in v0.17.0

func ForwardPorts(pod *k8sv1.Pod, ports []string, stop chan struct{}, readyTimeout time.Duration) error

func GenerateHelloWorldServer added in v0.19.0

func GenerateHelloWorldServer(vmi *v1.VirtualMachineInstance, testPort int, protocol string)

func GeneratePrivateKey added in v0.19.0

func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)

GeneratePrivateKey creates a RSA Private Key of specified byte size

func GeneratePublicKey added in v0.19.0

func GeneratePublicKey(privatekey *rsa.PublicKey) ([]byte, error)

GeneratePublicKey will return in the format "ssh-rsa ..."

func GenerateRESTReport added in v0.23.0

func GenerateRESTReport() error

func GenerateRandomMac added in v0.26.0

func GenerateRandomMac() (net.HardwareAddr, error)

func GenerateTemplateJson added in v0.7.0

func GenerateTemplateJson(template *vmsgen.Template, generateDirectory string) (string, error)

func GenerateVMIJson added in v0.6.1

func GenerateVMIJson(vmi *v1.VirtualMachineInstance, generateDirectory string) (string, error)

func GenerateVMJson added in v0.17.0

func GenerateVMJson(vm *v1.VirtualMachine, generateDirectory string) (string, error)

func GetAllSchedulableNodes added in v0.9.0

func GetAllSchedulableNodes(virtClient kubecli.KubevirtClient) *k8sv1.NodeList

func GetBundleFromConfigMap added in v0.29.0

func GetBundleFromConfigMap(configMapName string) ([]byte, []*x509.Certificate)

func GetCephStorageClass added in v0.20.5

func GetCephStorageClass() (string, bool)

func GetCertFromSecret added in v0.29.0

func GetCertFromSecret(secretName string) []byte

func GetCertsForPods added in v0.29.0

func GetCertsForPods(labelSelector string, namespace string, port string) ([][]byte, error)

GetCertsForPods returns the used certificates for all pods matching the label selector

func GetComputeContainerOfPod added in v0.19.0

func GetComputeContainerOfPod(pod *k8sv1.Pod) *k8sv1.Container

func GetContainerDiskContainerOfPod added in v0.19.0

func GetContainerDiskContainerOfPod(pod *k8sv1.Pod, volumeName string) *k8sv1.Container

func GetContainerOfPod added in v0.19.0

func GetContainerOfPod(pod *k8sv1.Pod, containerName string) *k8sv1.Container

func GetCurrentKv added in v0.29.0

func GetCurrentKv(virtClient kubecli.KubevirtClient) *v1.KubeVirt

func GetFedoraToolsGuestAgentBlacklistUserData added in v0.36.3

func GetFedoraToolsGuestAgentBlacklistUserData(commands string) string

func GetGuestAgentUserData added in v0.19.0

func GetGuestAgentUserData() string

func GetHighestCPUNumberAmongNodes added in v0.20.7

func GetHighestCPUNumberAmongNodes(virtClient kubecli.KubevirtClient) int

func GetK8sCmdClient added in v0.17.0

func GetK8sCmdClient() string

func GetKubeVirtConfigMap added in v0.26.5

func GetKubeVirtConfigMap() (*k8sv1.ConfigMap, error)

func GetKvList added in v0.29.0

func GetKvList(virtClient kubecli.KubevirtClient) []v1.KubeVirt

func GetListOfManifests added in v0.12.0

func GetListOfManifests(pathToManifestsDir string) []string

func GetNodeCPUInfo added in v0.6.3

func GetNodeCPUInfo(vmi *v1.VirtualMachineInstance) string

GetNodeCPUInfo returns output of lscpu on the pod that runs on the specified node

func GetNodeDrainKey added in v0.26.5

func GetNodeDrainKey() string

func GetNodeLibvirtCapabilities added in v0.6.2

func GetNodeLibvirtCapabilities(vmi *v1.VirtualMachineInstance) string

GetNodeLibvirtCapabilities returns node libvirt capabilities

func GetNodeWithHugepages added in v0.6.1

func GetNodeWithHugepages(virtClient kubecli.KubevirtClient, hugepages k8sv1.ResourceName) *k8sv1.Node

func GetPodsCertIfSynced added in v0.29.0

func GetPodsCertIfSynced(labelSelector string, namespace string, port string) (cert []byte, synced bool, err error)

GetPodsCertIfSynced returns the certificate for all matching pods once all of them use the same certificate

func GetRunningPodByLabel added in v0.3.0

func GetRunningPodByLabel(label string, labelType string, namespace string, node string) (*k8sv1.Pod, error)

func GetRunningPodByVirtualMachineInstance added in v0.8.0

func GetRunningPodByVirtualMachineInstance(vmi *v1.VirtualMachineInstance, namespace string) *k8sv1.Pod

func GetRunningVMIDomainSpec added in v0.28.0

func GetRunningVMIDomainSpec(vmi *v1.VirtualMachineInstance) (*launcherApi.DomainSpec, error)

func GetRunningVirtualMachineInstanceDomainXML added in v0.9.2

func GetRunningVirtualMachineInstanceDomainXML(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance) (string, error)

func GetUrl added in v0.26.4

func GetUrl(urlIndex int) string

func GetVmPodName added in v0.15.0

func GetVmPodName(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance) string

func HasBindingModeWaitForFirstConsumer added in v0.36.0

func HasBindingModeWaitForFirstConsumer() bool

func HasCDI added in v0.8.0

func HasCDI() bool

func HasDataVolumeCRD added in v0.17.0

func HasDataVolumeCRD() bool

func HasExperimentalIgnitionSupport added in v0.17.3

func HasExperimentalIgnitionSupport() bool

func HasFeature added in v0.16.0

func HasFeature(feature string) bool

func HasLiveMigration added in v0.16.0

func HasLiveMigration() bool

func IsLauncherCapabilityDropped added in v0.36.0

func IsLauncherCapabilityDropped(capability k8sv1.Capability) bool

func IsLauncherCapabilityValid added in v0.30.4

func IsLauncherCapabilityValid(capability k8sv1.Capability) bool

func IsOpenShift added in v0.12.0

func IsOpenShift() bool

func IsRunningOnKindInfra added in v0.29.0

func IsRunningOnKindInfra() bool

func IsUsingBuiltinNodeDrainKey added in v0.29.0

func IsUsingBuiltinNodeDrainKey() bool

func LibvirtDomainIsPersistent added in v0.36.3

func LibvirtDomainIsPersistent(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance) (bool, error)

func NewBool added in v0.3.0

func NewBool(x bool) *bool

func NewHTTPServerPod added in v0.34.0

func NewHTTPServerPod(port int) *corev1.Pod

func NewHelloWorldJob added in v0.6.0

func NewHelloWorldJob(host string, port string, checkConnectivityCmdPrefixes ...string) *batchv1.Job

NewHelloWorldJob takes a DNS entry or an IP and a port which it will use to create a job which tries to contact the host on the provided port. It expects to receive "Hello World!" to succeed.

func NewHelloWorldJobHTTP added in v0.33.0

func NewHelloWorldJobHTTP(host string, port string, checkConnectivityCmdPrefixes ...string) *batchv1.Job

NewHelloWorldJobHTTP gets an IP address and a port, which it uses to create a pod. This pod tries to contact the host on the provided port, over HTTP. On success - it expects to receive "Hello World!".

func NewHelloWorldJobUDP added in v0.6.0

func NewHelloWorldJobUDP(host string, port string, checkConnectivityCmdPrefixes ...string) *batchv1.Job

NewHelloWorldJobUDP takes a DNS entry or an IP and a port which it will use create a pod which tries to contact the host on the provided port. It expects to receive "Hello World!" to succeed. Note that in case of UDP, the server will not see the connection unless something is sent over it However, netcat does not work well with UDP and closes before the answer arrives, for that another netcat call is needed, this time as a UDP listener

func NewISCSIPV added in v0.22.0

func NewISCSIPV(name, size, iscsiTargetIP string, accessMode k8sv1.PersistentVolumeAccessMode, volumeMode k8sv1.PersistentVolumeMode) *k8sv1.PersistentVolume

func NewInt32 added in v0.0.3

func NewInt32(x int32) *int32

func NewInt64 added in v0.33.0

func NewInt64(x int64) *int64

func NewJob added in v0.33.0

func NewJob(name string, cmd, args []string, retry, ttlAfterFinished int32, timeout int64) *batchv1.Job

NewJob creates a job configuration that runs a single Pod. A name is used for the job & pod while the command and its arguments are passed to the pod for execution. In addition, the following arguments control the job behavior: retry: The number of times the job should try and run the pod. ttlAfterFinished: The period of time between the job finishing and its auto-deletion.

Make sure to leave enough time for the reporter to collect the logs.

timeout: The overall time at which the job is terminated, regardless of it finishing or not.

func NewRandomBlankDataVolume added in v0.36.0

func NewRandomBlankDataVolume(namespace, storageClass, size string, accessMode k8sv1.PersistentVolumeAccessMode, volumeMode k8sv1.PersistentVolumeMode) *cdiv1.DataVolume

func NewRandomDataVolumeWithHttpImport added in v0.8.0

func NewRandomDataVolumeWithHttpImport(imageUrl, namespace string, accessMode k8sv1.PersistentVolumeAccessMode) *cdiv1.DataVolume

func NewRandomDataVolumeWithHttpImportInStorageClass added in v0.31.0

func NewRandomDataVolumeWithHttpImportInStorageClass(imageUrl, namespace, storageClass string, accessMode k8sv1.PersistentVolumeAccessMode) *cdiv1.DataVolume

func NewRandomDataVolumeWithPVCSource added in v0.20.0

func NewRandomDataVolumeWithPVCSource(sourceNamespace, sourceName, targetNamespace string, accessMode k8sv1.PersistentVolumeAccessMode) *cdiv1.DataVolume

func NewRandomDataVolumeWithPVCSourceWithStorageClass added in v0.20.5

func NewRandomDataVolumeWithPVCSourceWithStorageClass(sourceNamespace, sourceName, targetNamespace, storageClass, size string, accessMode k8sv1.PersistentVolumeAccessMode) *cdiv1.DataVolume

func NewRandomDataVolumeWithRegistryImport added in v0.35.0

func NewRandomDataVolumeWithRegistryImport(imageUrl, namespace string, accessMode k8sv1.PersistentVolumeAccessMode) *cdiv1.DataVolume

func NewRandomFedoraVMIWitGuestAgent added in v0.16.1

func NewRandomFedoraVMIWitGuestAgent() *v1.VirtualMachineInstance

func NewRandomFedoraVMIWithBlacklistGuestAgent added in v0.36.3

func NewRandomFedoraVMIWithBlacklistGuestAgent(commands string) *v1.VirtualMachineInstance

func NewRandomFedoraVMIWithDmidecode added in v0.22.0

func NewRandomFedoraVMIWithDmidecode() *v1.VirtualMachineInstance

func NewRandomFedoraVMIWithVirtWhatCpuidHelper added in v0.34.0

func NewRandomFedoraVMIWithVirtWhatCpuidHelper() *v1.VirtualMachineInstance

func NewRandomMigration added in v0.9.2

func NewRandomMigration(vmiName string, namespace string) *v1.VirtualMachineInstanceMigration

func NewRandomReplicaSetFromVMI added in v0.6.1

func NewRandomReplicaSetFromVMI(vmi *v1.VirtualMachineInstance, replicas int32) *v1.VirtualMachineInstanceReplicaSet

func NewRandomVMI added in v0.6.1

func NewRandomVMI() *v1.VirtualMachineInstance

func NewRandomVMIWithCDRom added in v0.6.1

func NewRandomVMIWithCDRom(claimName string) *v1.VirtualMachineInstance

func NewRandomVMIWithConfigMap added in v0.9.0

func NewRandomVMIWithConfigMap(configMapName string) *v1.VirtualMachineInstance

func NewRandomVMIWithCustomMacAddress added in v0.6.4

func NewRandomVMIWithCustomMacAddress() *v1.VirtualMachineInstance

func NewRandomVMIWithDataVolume added in v0.8.0

func NewRandomVMIWithDataVolume(dataVolumeName string) *v1.VirtualMachineInstance

func NewRandomVMIWithEFIBootloader added in v0.14.0

func NewRandomVMIWithEFIBootloader() *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDisk added in v0.6.1

func NewRandomVMIWithEphemeralDisk(containerImage string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdata added in v0.19.0

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdata(containerImage string, userData string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdataHighMemory added in v0.19.0

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdataHighMemory(containerImage string, userData string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdataNetworkData added in v0.19.0

func NewRandomVMIWithEphemeralDiskAndConfigDriveUserdataNetworkData(containerImage, userData, networkData string, b64encode bool) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndUserdata added in v0.6.1

func NewRandomVMIWithEphemeralDiskAndUserdata(containerImage string, userData string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndUserdataHighMemory added in v0.6.1

func NewRandomVMIWithEphemeralDiskAndUserdataHighMemory(containerImage string, userData string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskAndUserdataNetworkData added in v0.14.0

func NewRandomVMIWithEphemeralDiskAndUserdataNetworkData(containerImage, userData, networkData string, b64encode bool) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralDiskHighMemory added in v0.6.1

func NewRandomVMIWithEphemeralDiskHighMemory(containerImage string) *v1.VirtualMachineInstance

func NewRandomVMIWithEphemeralPVC added in v0.6.1

func NewRandomVMIWithEphemeralPVC(claimName string) *v1.VirtualMachineInstance

func NewRandomVMIWithFSFromDataVolume added in v0.34.0

func NewRandomVMIWithFSFromDataVolume(dataVolumeName string) *v1.VirtualMachineInstance

func NewRandomVMIWithHostDisk added in v0.9.0

func NewRandomVMIWithHostDisk(diskPath string, diskType v1.HostDiskType, nodeName string) *v1.VirtualMachineInstance

func NewRandomVMIWithMasqueradeInterfaceEphemeralDiskAndUserdata added in v0.19.0

func NewRandomVMIWithMasqueradeInterfaceEphemeralDiskAndUserdata(containerImage string, userData string, Ports []v1.Port) *v1.VirtualMachineInstance

func NewRandomVMIWithNS added in v0.6.1

func NewRandomVMIWithNS(namespace string) *v1.VirtualMachineInstance

func NewRandomVMIWithPVC added in v0.6.1

func NewRandomVMIWithPVC(claimName string) *v1.VirtualMachineInstance

func NewRandomVMIWithPVCAndUserData added in v0.34.0

func NewRandomVMIWithPVCAndUserData(claimName, userData string) *v1.VirtualMachineInstance

func NewRandomVMIWithPVCFS added in v0.34.0

func NewRandomVMIWithPVCFS(claimName string) *v1.VirtualMachineInstance

func NewRandomVMIWithSecret added in v0.9.0

func NewRandomVMIWithSecret(secretName string) *v1.VirtualMachineInstance

func NewRandomVMIWithSecureBoot added in v0.30.4

func NewRandomVMIWithSecureBoot() *v1.VirtualMachineInstance

func NewRandomVMIWithServiceAccount added in v0.9.2

func NewRandomVMIWithServiceAccount(serviceAccountName string) *v1.VirtualMachineInstance

func NewRandomVMIWithSlirpInterfaceEphemeralDiskAndUserdata added in v0.7.0

func NewRandomVMIWithSlirpInterfaceEphemeralDiskAndUserdata(containerImage string, userData string, Ports []v1.Port) *v1.VirtualMachineInstance

func NewRandomVMIWithWatchdog added in v0.6.1

func NewRandomVMIWithWatchdog() *v1.VirtualMachineInstance

func NewRandomVMIWithe1000NetworkInterface added in v0.6.1

func NewRandomVMIWithe1000NetworkInterface() *v1.VirtualMachineInstance

func NewRandomVMWithCloneDataVolume added in v0.20.0

func NewRandomVMWithCloneDataVolume(sourceNamespace, sourceName, targetNamespace string) *v1.VirtualMachine

func NewRandomVMWithDataVolume added in v0.8.0

func NewRandomVMWithDataVolume(imageUrl string, namespace string) *v1.VirtualMachine

func NewRandomVMWithDataVolumeAndUserDataInStorageClass added in v0.34.0

func NewRandomVMWithDataVolumeAndUserDataInStorageClass(imageUrl, namespace, userData, storageClass string) *v1.VirtualMachine

func NewRandomVMWithDataVolumeInStorageClass added in v0.31.0

func NewRandomVMWithDataVolumeInStorageClass(imageUrl, namespace, storageClass string) *v1.VirtualMachine

func NewRandomVMWithEphemeralDisk

func NewRandomVMWithEphemeralDisk(containerImage string) *v1.VirtualMachine

func NewRandomVMWithRegistryDataVolume added in v0.35.0

func NewRandomVMWithRegistryDataVolume(imageUrl string, namespace string) *v1.VirtualMachine

func NewRandomVirtualMachine added in v0.8.0

func NewRandomVirtualMachine(vmi *v1.VirtualMachineInstance, running bool) *v1.VirtualMachine

func NewRandomVirtualMachineInstanceWithOCSDisk added in v0.20.5

func NewRandomVirtualMachineInstanceWithOCSDisk(imageUrl, namespace string, accessMode k8sv1.PersistentVolumeAccessMode, volMode k8sv1.PersistentVolumeMode) (*v1.VirtualMachineInstance, *cdiv1.DataVolume)

func NewRepeatableVirtctlCommand added in v0.4.0

func NewRepeatableVirtctlCommand(args ...string) func() error

func NewTCPServerPod added in v0.34.0

func NewTCPServerPod(port int) *corev1.Pod

func NewVirtctlCommand added in v0.4.0

func NewVirtctlCommand(args ...string) *cobra.Command

func NotDeleted added in v0.5.0

func NotDeleted(vmis *v1.VirtualMachineInstanceList) (notDeleted []v1.VirtualMachineInstance)

func PanicOnError

func PanicOnError(err error)

func PodReady added in v0.20.0

func PodReady(pod *k8sv1.Pod) k8sv1.ConditionStatus

func PrometheusRuleEnabled added in v0.26.0

func PrometheusRuleEnabled() bool

PrometheusRuleEnabled returns true if the PrometheusRule CRD is enabled and false otherwise.

func RandTmpDir added in v0.29.0

func RandTmpDir() string

func ReadManifestYamlFile added in v0.12.0

func ReadManifestYamlFile(pathToManifest string) []unstructured.Unstructured

func RemoveHostDiskImage added in v0.9.0

func RemoveHostDiskImage(diskPath string, nodeName string)

func RemoveLabelFromNode added in v0.16.0

func RemoveLabelFromNode(nodeName string, key string)

func RenderHostPathPod added in v0.33.0

func RenderHostPathPod(podName string, dir string, hostPathType k8sv1.HostPathType, mountPropagation k8sv1.MountPropagationMode, cmd []string, args []string) *k8sv1.Pod

func RenderPod added in v0.33.0

func RenderPod(name string, cmd []string, args []string) *k8sv1.Pod

func RestoreKubeVirtResource added in v0.29.0

func RestoreKubeVirtResource()

func RetryIfModified added in v0.22.0

func RetryIfModified(do func() error) (err error)

func RetryWithMetadataIfModified added in v0.23.0

func RetryWithMetadataIfModified(objectMeta metav1.ObjectMeta, do func(objectMeta metav1.ObjectMeta) error) (err error)

func RunCommand added in v0.8.0

func RunCommand(cmdName string, args ...string) (string, string, error)

func RunCommandOnVmiPod added in v0.6.3

func RunCommandOnVmiPod(vmi *v1.VirtualMachineInstance, command []string) string

RunCommandOnVmiPod runs specified command on the virt-launcher pod

func RunCommandPipe added in v0.9.2

func RunCommandPipe(commands ...[]string) (string, string, error)

func RunCommandPipeWithNS added in v0.9.2

func RunCommandPipeWithNS(namespace string, commands ...[]string) (string, string, error)

func RunCommandWithNS added in v0.9.2

func RunCommandWithNS(namespace string, cmdName string, args ...string) (string, string, error)

func RunCommandWithNSAndInput added in v0.20.0

func RunCommandWithNSAndInput(namespace string, input io.Reader, cmdName string, args ...string) (string, string, error)

func RunMigrationAndExpectCompletion added in v0.35.0

func RunMigrationAndExpectCompletion(virtClient kubecli.KubevirtClient, migration *v1.VirtualMachineInstanceMigration, timeout int) string

func RunVMI added in v0.9.0

func RunVMI(vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstance

func RunVMIAndExpectLaunch added in v0.9.0

func RunVMIAndExpectLaunch(vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstance

func RunVMIAndExpectLaunchIgnoreWarnings added in v0.29.0

func RunVMIAndExpectLaunchIgnoreWarnings(vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstance

func RunVMIAndExpectLaunchWithIgnoreWarningArg added in v0.30.0

func RunVMIAndExpectLaunchWithIgnoreWarningArg(vmi *v1.VirtualMachineInstance, timeout int, ignoreWarnings bool) *v1.VirtualMachineInstance

func RunVMIAndExpectScheduling added in v0.17.0

func RunVMIAndExpectScheduling(vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstance

func Running added in v0.35.0

func Running(vmis *v1.VirtualMachineInstanceList) (running []v1.VirtualMachineInstance)

func ServiceMonitorEnabled added in v0.20.6

func ServiceMonitorEnabled() bool

func ShouldUseEmulation added in v0.35.0

func ShouldUseEmulation(virtClient kubecli.KubevirtClient) bool

func SkipIfNoCmd added in v0.8.0

func SkipIfNoCmd(cmdName string)

func SkipIfNoRhelImage added in v0.9.0

func SkipIfNoRhelImage(virtClient kubecli.KubevirtClient)

func SkipIfNoWindowsImage added in v0.4.1

func SkipIfNoWindowsImage(virtClient kubecli.KubevirtClient)

func SkipIfOpenShift added in v0.8.0

func SkipIfOpenShift(message string)

func SkipIfOpenShift4 added in v0.22.0

func SkipIfOpenShift4(message string)

func SkipIfOpenShiftAndBelowOrEqualVersion added in v0.20.0

func SkipIfOpenShiftAndBelowOrEqualVersion(message string, version string)

func SkipIfUseFlannel added in v0.9.0

func SkipIfUseFlannel(virtClient kubecli.KubevirtClient)

func SkipIfVersionAboveOrEqual added in v0.18.0

func SkipIfVersionAboveOrEqual(message string, expectedVersion string)

func SkipIfVersionBelow added in v0.7.0

func SkipIfVersionBelow(message string, expectedVersion string)

SkipIfVersionBelow will skip tests if it runs on an environment with k8s version below specified

func SkipNFSTestIfRunnigOnKindInfra added in v0.30.0

func SkipNFSTestIfRunnigOnKindInfra()

func SkipPVCTestIfRunnigOnKindInfra added in v0.29.0

func SkipPVCTestIfRunnigOnKindInfra()

func SkipSELinuxTestIfRunnigOnKindInfra added in v0.30.5

func SkipSELinuxTestIfRunnigOnKindInfra()

func StartHTTPServer added in v0.11.0

func StartHTTPServer(vmi *v1.VirtualMachineInstance, port int)

func StartHTTPServerPod added in v0.34.0

func StartHTTPServerPod(port int) *corev1.Pod

func StartTCPServer added in v0.11.0

func StartTCPServer(vmi *v1.VirtualMachineInstance, port int)

func StartTCPServerPod added in v0.34.0

func StartTCPServerPod(port int) *corev1.Pod

func StartVirtualMachine added in v0.8.0

func StartVirtualMachine(vm *v1.VirtualMachine) *v1.VirtualMachine

func StartVmOnNode added in v0.6.3

func StartVmOnNode(vmi *v1.VirtualMachineInstance, nodeName string) *v1.VirtualMachineInstance

StartVmOnNode starts a VMI on the specified node

func StopVirtualMachine added in v0.8.0

func StopVirtualMachine(vm *v1.VirtualMachine) *v1.VirtualMachine

func SynchronizedAfterTestSuiteCleanup added in v0.34.0

func SynchronizedAfterTestSuiteCleanup()

func SynchronizedBeforeTestSetup added in v0.34.0

func SynchronizedBeforeTestSetup() []byte

func Taint added in v0.16.0

func Taint(nodeName string, key string, effect k8sv1.TaintEffect)

func UnfinishedVMIPodSelector added in v0.6.1

func UnfinishedVMIPodSelector(vmi *v1.VirtualMachineInstance) metav1.ListOptions

func UpdateCDIConfigMap added in v0.35.0

func UpdateCDIConfigMap(cdiConfig *k8sv1.ConfigMap) *k8sv1.ConfigMap

func UpdateClusterConfigValueAndWait added in v0.20.7

func UpdateClusterConfigValueAndWait(key string, value string) string

UpdateClusterConfigValueAndWait updates the given configuration in the kubevirt config map and then waits to allow the configuration events to be propagated to the consumers.

func UpdateKubeVirtConfigValueAndWait added in v0.35.0

func UpdateKubeVirtConfigValueAndWait(kvConfig v1.KubeVirtConfiguration) *v1.KubeVirt

UpdateKubeVirtConfigValueAndWait updates the given configuration in the kubevirt custom resource and then waits to allow the configuration events to be propagated to the consumers.

func WaitAgentConnected added in v0.19.0

func WaitAgentConnected(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance)

func WaitForAllPodsReady added in v0.12.0

func WaitForAllPodsReady(timeout time.Duration, listOptions metav1.ListOptions)

func WaitForConfigToBePropagatedToComponent added in v0.35.0

func WaitForConfigToBePropagatedToComponent(podLabel string, resourceVersion string, compareResourceVersions compare)

func WaitForDataVolumePhaseWFFC added in v0.36.0

func WaitForDataVolumePhaseWFFC(namespace, name string, seconds int)

func WaitForDataVolumeReady added in v0.36.0

func WaitForDataVolumeReady(namespace, name string, seconds int)

func WaitForDataVolumeReadyToStartVMI added in v0.36.0

func WaitForDataVolumeReadyToStartVMI(obj runtime.Object, seconds int)

Block until DataVolume succeeds on storage with Immediate binding or is in WaitForFirstConsumer state on storage with WaitForFirstConsumer binding.

func WaitForJobToFail added in v0.33.0

func WaitForJobToFail(job *batchv1.Job, timeout time.Duration) error

WaitForJobToFail blocks until the given job finishes. On failure, it returns with a nil error, on success or timeout it returns with an error.

func WaitForJobToSucceed added in v0.33.0

func WaitForJobToSucceed(job *batchv1.Job, timeout time.Duration) error

WaitForJobToSucceed blocks until the given job finishes. On success, it returns with a nil error, on failure or timeout it returns with an error.

func WaitForMigrationToDisappearWithTimeout added in v0.16.0

func WaitForMigrationToDisappearWithTimeout(migration *v1.VirtualMachineInstanceMigration, seconds int)

func WaitForPodToDisappearWithTimeout added in v0.27.0

func WaitForPodToDisappearWithTimeout(podName string, seconds int)

func WaitForSuccessfulDataVolumeImport added in v0.12.0

func WaitForSuccessfulDataVolumeImport(dv *cdiv1.DataVolume, seconds int)

func WaitForSuccessfulVMIStart added in v0.6.1

func WaitForSuccessfulVMIStart(vmi runtime.Object) string

func WaitForSuccessfulVMIStartIgnoreWarnings added in v0.6.1

func WaitForSuccessfulVMIStartIgnoreWarnings(vmi runtime.Object) string

func WaitForSuccessfulVMIStartWithContext added in v0.35.0

func WaitForSuccessfulVMIStartWithContext(ctx context.Context, vmi runtime.Object) string

func WaitForSuccessfulVMIStartWithTimeout added in v0.6.1

func WaitForSuccessfulVMIStartWithTimeout(vmi runtime.Object, seconds int) (nodeName string)

func WaitForSuccessfulVMIStartWithTimeoutIgnoreWarnings added in v0.19.0

func WaitForSuccessfulVMIStartWithTimeoutIgnoreWarnings(vmi runtime.Object, seconds int) string

func WaitForVMCondition added in v0.24.0

func WaitForVMCondition(virtClient kubecli.KubevirtClient, vm *v1.VirtualMachine, conditionType v1.VirtualMachineConditionType, timeoutSec int)

func WaitForVMConditionRemovedOrFalse added in v0.24.0

func WaitForVMConditionRemovedOrFalse(virtClient kubecli.KubevirtClient, vm *v1.VirtualMachine, conditionType v1.VirtualMachineConditionType, timeoutSec int)

func WaitForVMICondition added in v0.24.0

func WaitForVMICondition(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, conditionType v1.VirtualMachineInstanceConditionType, timeoutSec int)

func WaitForVMIConditionRemovedOrFalse added in v0.24.0

func WaitForVMIConditionRemovedOrFalse(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, conditionType v1.VirtualMachineInstanceConditionType, timeoutSec int)

func WaitForVMIStartOrFailed added in v0.36.0

func WaitForVMIStartOrFailed(obj runtime.Object, seconds int, ignoreWarnings bool) (nodeName string)

Block until the specified VirtualMachineInstance reached either Failed or Running states

func WaitForVirtualMachineToDisappearWithTimeout added in v0.5.0

func WaitForVirtualMachineToDisappearWithTimeout(vmi *v1.VirtualMachineInstance, seconds int)

func WaitUntilVMIReady added in v0.8.0

func WaitUntilVMIReady(vmi *v1.VirtualMachineInstance, loginTo console.LoginToFactory) *v1.VirtualMachineInstance

func WaitUntilVMIReadyAsync added in v0.35.0

func WaitUntilVMIReadyAsync(ctx context.Context, vmi *v1.VirtualMachineInstance, loginTo console.LoginToFactory) func() *v1.VirtualMachineInstance

func WaitUntilVMIReadyWithContext added in v0.35.0

func WaitUntilVMIReadyWithContext(ctx context.Context, vmi *v1.VirtualMachineInstance, loginTo console.LoginToFactory) *v1.VirtualMachineInstance

func WipeTestingInfrastructure added in v0.12.0

func WipeTestingInfrastructure()

Types

type EventType

type EventType string
const (
	NormalEvent  EventType = "Normal"
	WarningEvent EventType = "Warning"
)

type KubeVirtTestsConfiguration added in v0.16.0

type KubeVirtTestsConfiguration struct {
	// StorageClass to use to create local PVCs
	StorageClassLocal string `json:"storageClassLocal"`
	// StorageClass to use to create host-path PVCs
	StorageClassHostPath string `json:"storageClassHostPath"`
	// StorageClass to use to create block-volume PVCs
	StorageClassBlockVolume string `json:"storageClassBlockVolume"`
	// StorageClass to use to create rhel PVCs
	StorageClassRhel string `json:"storageClassRhel"`
	// StorageClass to use to create windows PVCs
	StorageClassWindows string `json:"storageClassWindows"`
	// Flag if true the storageclasses are managed, false otherwise
	ManageStorageClasses bool `json:"manageStorageClasses"`
}

KubeVirtTestsConfiguration contains the configuration for KubeVirt tests

type ObjectEventWatcher

type ObjectEventWatcher struct {
	// contains filtered or unexported fields
}

func NewObjectEventWatcher

func NewObjectEventWatcher(object runtime.Object) *ObjectEventWatcher

func (*ObjectEventWatcher) FailOnWarnings

func (w *ObjectEventWatcher) FailOnWarnings() *ObjectEventWatcher

func (*ObjectEventWatcher) SinceNow

func (w *ObjectEventWatcher) SinceNow() *ObjectEventWatcher

SinceNow sets a watch starting point for events, from the moment on the connection to the apiserver was established.

func (*ObjectEventWatcher) SinceObjectResourceVersion

func (w *ObjectEventWatcher) SinceObjectResourceVersion(object runtime.Object) *ObjectEventWatcher

SinceObjectResourceVersion takes the resource version of the passed in runtime object and takes it as the starting point for all events to watch for.

func (*ObjectEventWatcher) SinceResourceVersion

func (w *ObjectEventWatcher) SinceResourceVersion(rv string) *ObjectEventWatcher

SinceResourceVersion sets the passed in resourceVersion as the starting point for all events to watch for.

func (*ObjectEventWatcher) SinceWatchedObjectResourceVersion

func (w *ObjectEventWatcher) SinceWatchedObjectResourceVersion() *ObjectEventWatcher

SinceWatchedObjectResourceVersion takes the resource version of the runtime object which is watched, and takes it as the starting point for all events to watch for.

func (*ObjectEventWatcher) Timeout

func (w *ObjectEventWatcher) Timeout(duration time.Duration) *ObjectEventWatcher

func (*ObjectEventWatcher) WaitFor

func (w *ObjectEventWatcher) WaitFor(ctx context.Context, eventType EventType, reason interface{}) (e *k8sv1.Event)

func (*ObjectEventWatcher) WaitNotFor added in v0.11.0

func (w *ObjectEventWatcher) WaitNotFor(ctx context.Context, eventType EventType, reason interface{}) (e *k8sv1.Event)

func (*ObjectEventWatcher) Watch

func (w *ObjectEventWatcher) Watch(ctx context.Context, processFunc ProcessFunc, watchedDescription string)

type ProcessFunc

type ProcessFunc func(event *k8sv1.Event) (done bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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