Skip to content

Commit

Permalink
tests: move AddExplicitPodNetworkInterface next to its single user
Browse files Browse the repository at this point in the history
This makes tests/utils.go slightly smaller.

Signed-off-by: Dan Kenigsberg <danken@redhat.com>
  • Loading branch information
dankenigsberg committed Jan 26, 2024
1 parent b6e211f commit 7412447
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 9 additions & 1 deletion tests/sysprep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ func insertProductKeyToAnswerFileTemplate(answerFileTemplate string) string {
return fmt.Sprintf(answerFileTemplate, productKey)
}

// addExplicitPodNetworkInterface
//
// Deprecated: Use libvmi
func addExplicitPodNetworkInterface(vmi *v1.VirtualMachineInstance) {
vmi.Spec.Domain.Devices.Interfaces = []v1.Interface{*v1.DefaultMasqueradeNetworkInterface()}
vmi.Spec.Networks = []v1.Network{*v1.DefaultPodNetwork()}
}

var getWindowsSysprepVMISpec = func() v1.VirtualMachineInstanceSpec {
gracePeriod := int64(0)
spinlocks := uint32(8191)
Expand Down Expand Up @@ -310,7 +318,7 @@ var _ = Describe("[Serial][Sysprep][sig-compute]Syspreped VirtualMachineInstance
windowsVMI = tests.NewRandomVMI()
windowsVMI.Spec = getWindowsSysprepVMISpec()
tests.CreateConfigMap("sysprepautounattend", windowsVMI.Namespace, map[string]string{"Autounattend.xml": answerFileWithKey, "Unattend.xml": answerFileWithKey})
tests.AddExplicitPodNetworkInterface(windowsVMI)
addExplicitPodNetworkInterface(windowsVMI)
windowsVMI.Spec.Domain.Devices.Interfaces[0].Model = "e1000"
})

Expand Down
8 changes: 0 additions & 8 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,14 +1005,6 @@ func AddServiceAccountDisk(vmi *v1.VirtualMachineInstance, serviceAccountName st
})
}

// AddExplicitPodNetworkInterface
//
// Deprecated: Use libvmi
func AddExplicitPodNetworkInterface(vmi *v1.VirtualMachineInstance) {
vmi.Spec.Domain.Devices.Interfaces = []v1.Interface{*v1.DefaultMasqueradeNetworkInterface()}
vmi.Spec.Networks = []v1.Network{*v1.DefaultPodNetwork()}
}

// AddWatchdog
//
// Deprecated: Use libvmi
Expand Down
3 changes: 1 addition & 2 deletions tests/windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ var _ = Describe("[Serial][sig-compute]Windows VirtualMachineInstance", Serial,
virtClient = kubevirt.Client()
checks.SkipIfMissingRequiredImage(virtClient, libvmi.WindowsPVCName)
libstorage.CreatePVC(OSWindows, testsuite.GetTestNamespace(nil), "30Gi", libstorage.Config.StorageClassWindows, true)
windowsVMI = libvmi.NewWindows()
tests.AddExplicitPodNetworkInterface(windowsVMI)
windowsVMI = libvmi.NewWindows(libvmi.WithMasqueradeNetworking()...)
windowsVMI.Spec.Domain.Devices.Interfaces[0].Model = "e1000"
})

Expand Down

0 comments on commit 7412447

Please sign in to comment.