Skip to content

Commit

Permalink
tests,macvtap: Consolidate VMI with custom MAC test with migration test
Browse files Browse the repository at this point in the history
Signed-off-by: Or Mergi <[email protected]>
  • Loading branch information
ormergi committed Feb 5, 2024
1 parent 6e5fcc9 commit 302af32
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions tests/network/bindingplugin_macvtap.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,6 @@ var _ = SIGDescribe("VirtualMachineInstance with macvtap network binding plugin"
clientMAC = mac.String()
})

It("should successfully create a VM with macvtap interface with custom MAC address", func() {
vmi := libvmi.NewAlpineWithTestTooling(
libvmi.WithInterface(*libvmi.InterfaceWithMac(
libvmi.InterfaceWithMacvtapBindingPlugin(macvtapNetworkName), serverMAC)),
libvmi.WithNetwork(libvmi.MultusNetwork(macvtapNetworkName, macvtapNetworkName)),
)
vmi, err := kubevirt.Client().VirtualMachineInstance(testsuite.GetTestNamespace(nil)).Create(context.Background(), vmi)
Expect(err).ToNot(HaveOccurred(), "should create VMI successfully")
vmi = libwait.WaitUntilVMIReady(vmi, console.LoginToAlpine)

Expect(vmi.Status.Interfaces).To(HaveLen(1), "should have a single interface")
Expect(vmi.Status.Interfaces[0].MAC).To(Equal(serverMAC), "the expected MAC address should be set in the VMI")
})

It("two VMs with macvtap interface should be able to communicate over macvtap network", func() {
const (
guestIfaceName = "eth0"
Expand Down Expand Up @@ -150,6 +136,9 @@ var _ = SIGDescribe("VirtualMachineInstance with macvtap network binding plugin"
})

It("should be successful when the VMI MAC address is defined in its spec", func() {
Expect(clientVMI.Status.Interfaces).To(HaveLen(1), "should have a single interface")
Expect(clientVMI.Status.Interfaces[0].MAC).To(Equal(clientMAC), "the expected MAC address should be set in the VMI")

By("starting the migration")
migration := libmigration.New(clientVMI.Name, clientVMI.Namespace)
migration = libmigration.RunMigrationAndExpectToCompleteWithDefaultTimeout(kubevirt.Client(), migration)
Expand Down

0 comments on commit 302af32

Please sign in to comment.