mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
networking anaconda layout: add basic test
This commit is contained in:
parent
051de33f30
commit
792af2d170
1 changed files with 75 additions and 0 deletions
75
test/verify/check-networkmanager-anaconda
Executable file
75
test/verify/check-networkmanager-anaconda
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
|
||||
|
||||
#
|
||||
# Copyright (C) 2026 Red Hat, Inc.
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
import netlib
|
||||
import testlib
|
||||
from lib.constants import TEST_OS_DEFAULT
|
||||
|
||||
|
||||
@testlib.nondestructive
|
||||
@testlib.skipOstree("No /sysroot and directory cannot be created on read-only filesystem")
|
||||
@testlib.onlyImage("hostapd/NM-wifi not installed on our test image", TEST_OS_DEFAULT)
|
||||
class TestNetworkingAnaconda(netlib.NetworkCase):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.setup_wireless_networks()
|
||||
|
||||
def anaconda_wait_for_iface(self, iface: str, active: bool = True) -> None:
|
||||
b = self.browser
|
||||
sel = f"#networking-interfaces button[data-interface='{iface}']"
|
||||
|
||||
if active:
|
||||
state = "Connected"
|
||||
else:
|
||||
state = "Disconnected"
|
||||
|
||||
try:
|
||||
with b.wait_timeout(30):
|
||||
b.wait_in_text(sel, state)
|
||||
except testlib.Error as e:
|
||||
print(f"Interface {iface} didn't show up.")
|
||||
print(self.machine.execute(f"grep . /sys/class/net/*/address; nmcli con; nmcli dev; nmcli dev show {iface} || true"))
|
||||
raise e
|
||||
|
||||
def anaconda_select_iface(self, iface: str) -> None:
|
||||
self.browser.click(f"#networking-interfaces button[data-interface='{iface}']")
|
||||
|
||||
def testBasic(self) -> None:
|
||||
b = self.browser
|
||||
|
||||
self.login_and_go("/network")
|
||||
self.enterAnacondaMode({}, "/network")
|
||||
|
||||
# Anaconda Layout should be visible
|
||||
b.wait_visible("#networking.anaconda")
|
||||
|
||||
iface = "cockpit1"
|
||||
self.add_veth(iface, dhcp_cidr="10.111.113.1/24", dhcp_range=['10.111.113.2', '10.111.113.254'])
|
||||
self.anaconda_wait_for_iface(iface, active=False)
|
||||
|
||||
# Select interface and check details
|
||||
self.anaconda_select_iface(iface)
|
||||
b.wait_text("#network-interface-name", iface)
|
||||
# enable connection
|
||||
self.toggle_onoff("label[for='interface-switch']")
|
||||
self.anaconda_wait_for_iface(iface, active=True)
|
||||
self.wait_for_iface_setting('Status', "10.111.113")
|
||||
|
||||
# Wireless connection
|
||||
iface = self.iface
|
||||
self.anaconda_wait_for_iface(iface, active=False)
|
||||
self.anaconda_select_iface(iface)
|
||||
b.wait_text("#network-interface-name", iface)
|
||||
# Connect to the OpenNet WiFi
|
||||
b.wait_visible("tr[data-ssid='OpenNet'] [data-label='Mode'] [aria-label='open']")
|
||||
b.click("tr[data-ssid='OpenNet'] button[aria-label='Connect']")
|
||||
self.anaconda_wait_for_iface(iface, active=True)
|
||||
b.wait_visible("tr[data-ssid='OpenNet'] .nm-icon-connected")
|
||||
self.wait_for_iface_setting('Status', '10.0.42')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
testlib.test_main()
|
||||
Loading…
Reference in a new issue