Skip to content

Commit

Permalink
e2e, passt: Extend test to cover explicit MAC and PCI addresses setting
Browse files Browse the repository at this point in the history
Signed-off-by: Or Mergi <[email protected]>
  • Loading branch information
ormergi committed Oct 24, 2023
1 parent ae1014b commit 1d48ef1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/network/vmi_passt.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,17 @@ var _ = SIGDescribe("[Serial] Passt", decorators.PasstGate, Serial, func() {

Context("VirtualMachineInstance with passt binding mechanism", func() {

It("should report the IP to the status", func() {
It("should apply the interface configuration", func() {
const testMACAddr = "02:02:02:02:02:02"
const testPCIAddr = "0000:01:00.0"
vmi := libvmi.NewAlpineWithTestTooling(
libvmi.WithPasstInterfaceWithPort(),
libvmi.WithInterface(v1.Interface{
Name: libvmi.DefaultInterfaceName,
InterfaceBindingMethod: v1.InterfaceBindingMethod{Passt: &v1.InterfacePasst{}},
Ports: []v1.Port{{Port: 1234, Protocol: "TCP"}},
MacAddress: testMACAddr,
PciAddress: testPCIAddr,
}),
libvmi.WithNetwork(v1.DefaultPodNetwork()),
)

Expand All @@ -74,6 +82,11 @@ var _ = SIGDescribe("[Serial] Passt", decorators.PasstGate, Serial, func() {
Expect(vmi.Status.Interfaces).To(HaveLen(1))
Expect(vmi.Status.Interfaces[0].IPs).NotTo(BeEmpty())
Expect(vmi.Status.Interfaces[0].IP).NotTo(BeEmpty())
Expect(vmi.Status.Interfaces[0].MAC).To(Equal(testMACAddr))

guestIfaceName := vmi.Status.Interfaces[0].InterfaceName
cmd := fmt.Sprintf("ls /sys/bus/pci/devices/%s/virtio0/net/%s", testPCIAddr, guestIfaceName)
Expect(console.RunCommand(vmi, cmd, time.Second*5)).To(Succeed())
})

Context("should allow regular network connection", func() {
Expand Down

0 comments on commit 1d48ef1

Please sign in to comment.