Skip to content

Commit

Permalink
Merge pull request kubevirt#10945 from dankenigsberg/less-utils-NewRa…
Browse files Browse the repository at this point in the history
…ndomFedoraVMIWithEphemeralDiskHighMemory

tests/utils: replace a long-named function with libvmi.NewFedora
  • Loading branch information
kubevirt-bot authored Jan 3, 2024
2 parents 76563fb + 71a6109 commit 817589e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
18 changes: 1 addition & 17 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,6 @@ func NewRandomVMWithDataVolumeAndUserDataInStorageClass(imageUrl, namespace, use
return NewRandomVMWithDataVolumeAndUserData(dataVolume, userData)
}

func NewRandomVMIWithEphemeralDiskHighMemory(containerImage string) *v1.VirtualMachineInstance {
vmi := NewRandomVMIWithEphemeralDisk(containerImage)

vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("512M")
return vmi
}

func NewRandomVMIWithEphemeralDiskAndUserdataHighMemory(containerImage string, userData string) *v1.VirtualMachineInstance {
vmi := NewRandomVMIWithEphemeralDiskAndUserdata(containerImage, userData)

Expand Down Expand Up @@ -774,11 +767,6 @@ func NewRandomFedoraVMIWithBlacklistGuestAgent(commands string) *v1.VirtualMachi
)
}

func NewRandomFedoraVMIWithEphemeralDiskHighMemory() *v1.VirtualMachineInstance {
vmi := NewRandomVMIWithEphemeralDiskHighMemory(cd.ContainerDiskFor(cd.ContainerDiskFedoraTestTooling))
return vmi
}

func GetFedoraToolsGuestAgentBlacklistUserData(commands string) string {
return fmt.Sprintf(`#!/bin/bash
echo -e "\n\nBLACKLIST_RPC=%s" | sudo tee -a /etc/sysconfig/qemu-ga
Expand Down Expand Up @@ -943,18 +931,14 @@ func NewRandomVMIWithHostDisk(diskPath string, diskType v1.HostDiskType, nodeNam
}

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

}
func AddConfigMapDiskWithCustomLabel(vmi *v1.VirtualMachineInstance, configMapName string, volumeName string, volumeLabel string) {
vmi.Spec.Volumes = append(vmi.Spec.Volumes, v1.Volume{
Name: volumeName,
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: k8sv1.LocalObjectReference{
Name: configMapName,
},
VolumeLabel: volumeLabel,
VolumeLabel: "",
},
},
})
Expand Down
8 changes: 4 additions & 4 deletions tests/vmi_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2939,7 +2939,7 @@ var _ = Describe("[sig-compute]Configurations", decorators.SigCompute, func() {
Context("[rfe_id:2926][crit:medium][vendor:[email protected]][level:component]Check Chassis value", func() {

It("[Serial][test_id:2927]Test Chassis value in a newly created VM", Serial, func() {
vmi := tests.NewRandomFedoraVMIWithEphemeralDiskHighMemory()
vmi := libvmi.NewFedora()
vmi.Spec.Domain.Chassis = &v1.Chassis{
Asset: "Test-123",
}
Expand Down Expand Up @@ -2971,7 +2971,7 @@ var _ = Describe("[sig-compute]Configurations", decorators.SigCompute, func() {
var vmi *v1.VirtualMachineInstance

BeforeEach(func() {
vmi = tests.NewRandomFedoraVMIWithEphemeralDiskHighMemory()
vmi = libvmi.NewFedora()
})

It("[test_id:2751]test default SMBios", func() {
Expand Down Expand Up @@ -3053,7 +3053,7 @@ var _ = Describe("[sig-compute]Configurations", decorators.SigCompute, func() {
var DiskBusIDE v1.DiskBus = "ide"

BeforeEach(func() {
vmi = tests.NewRandomFedoraVMIWithEphemeralDiskHighMemory()
vmi = libvmi.NewFedora()
})

DescribeTable("For various bus types", func(bus v1.DiskBus, errMsg string) {
Expand Down Expand Up @@ -3164,7 +3164,7 @@ var _ = Describe("[sig-compute]Configurations", decorators.SigCompute, func() {
BeforeEach(func() {
checks.SkipIfRunningOnKindInfra("Skip KVM MSR prescence test on kind")

vmi = tests.NewRandomFedoraVMIWithEphemeralDiskHighMemory()
vmi = libvmi.NewFedora()
})

It("[test_id:5271]test cpuid hidden", func() {
Expand Down

0 comments on commit 817589e

Please sign in to comment.