Skip to content

Commit

Permalink
test: add some checks about the source of NICs
Browse files Browse the repository at this point in the history
  • Loading branch information
yunmingyang authored and martinpitt committed Nov 30, 2023
1 parent 45c874c commit 29d4565
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/check-machines-nics
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ class TestMachinesNICs(VirtualMachinesCase):
self.goToVmPage("subVmTest1")

b.wait_in_text("#vm-subVmTest1-network-1-type", "network")
b.wait_in_text('#vm-subVmTest1-networks td[data-label="Source"]', "Network")
b.wait_in_text("#vm-subVmTest1-network-1-source", "default")
b.wait_in_text('#vm-subVmTest1-networks td[data-label="Source"]', "TAP device")
b.wait_in_text("#vm-subVmTest1-network-1-tapdevice", "vnet0")
b.wait_in_text("#vm-subVmTest1-network-1-ipv4-address", "192.168.122.")
b.wait_visible('td[data-label="IP address"].pf-m-width-20')
b.wait_in_text("#vm-subVmTest1-network-1-state", "up")
b.assert_pixels("#vm-subVmTest1-networks",
"vm-details-nics-card",
Expand Down Expand Up @@ -82,12 +85,14 @@ class TestMachinesNICs(VirtualMachinesCase):

# vNICs are alphabetically sorted by MAC address, so now the new vNIC is first in the list
b.wait_in_text("#vm-subVmTest1-network-1-type", "bridge")
b.wait_in_text('#vm-subVmTest1-networks tbody:nth-child(2) td[data-label="Source"]', "Bridge")
b.wait_in_text("#vm-subVmTest1-network-1-source", "virbr0")

# Non-running VM doesn't have IP address present, so the "IP address" column should not be present
b.wait_visible("th:contains('IP address')")
self.performAction("subVmTest1", "forceOff")
b.wait_not_present("th:contains('IP address')")
b.wait_not_in_text('#vm-subVmTest1-networks tbody:nth-child(2) td[data-label="Source"]', "TAP device")

# Sources in Add vNIC dialog should be alphabetically sorted
m.execute("ip link add name abridge type bridge")
Expand Down Expand Up @@ -564,6 +569,9 @@ class TestMachinesNICs(VirtualMachinesCase):
source_type="direct",
source="eth43",
).execute()
# Check "Source" of the 'direct' NIC
b.wait_in_text('#vm-subVmTest1-networks tbody tr:nth-child(1) td[data-label="Source"]', "Direct")
b.wait_not_in_text('#vm-subVmTest1-networks tbody tr:nth-child(1) td[data-label="Source"]', "TAP device")

b.click("#vm-subVmTest1-system-run")
b.wait_in_text("#vm-subVmTest1-system-state", "Running")
Expand Down Expand Up @@ -591,6 +599,7 @@ class TestMachinesNICs(VirtualMachinesCase):
remove=False
).execute()
b.wait_visible("#vm-subVmTest1-network-2-edit-dialog[aria-disabled=true]")
b.wait_in_text('#vm-subVmTest1-network-2-tapdevice', "macvtap")

class NICAddDialog:

Expand Down

0 comments on commit 29d4565

Please sign in to comment.