Verified Commit 8197146c authored by Karel Koci's avatar Karel Koci 🤘
Browse files

tests: use container.shell for wait scripts invocation

The previous commit added shell property exactly for this. This now
tweaks code to use it.
parent 335126c4
......@@ -131,7 +131,7 @@ def fixture_client_board(board, board_serial, board_root_password, lan1_client):
board.set_serial_flush(True)
# Now spawn client container and connect
nsfarm.cli.Shell(lan1_client.pexpect()).run('wait4network')
lan1_client.shell.run('wait4network')
pexp = lan1_client.pexpect(['ssh', '-q', '192.168.1.1'])
pexp.expect_exact("root@192.168.1.1's password:")
pexp.sendline(board_root_password)
......@@ -151,7 +151,7 @@ def fixture_isp_container(lxd, device_map):
"""Minimal ISP container used to provide the Internet access for the most of the tests.
"""
with nsfarm.lxd.Container(lxd, 'isp-common', device_map) as container:
nsfarm.cli.Shell(container.pexpect()).run('wait4network')
container.shell.run('wait4network')
yield container
......@@ -160,7 +160,7 @@ def fixture_lan1_client(lxd, device_map):
"""Starts client container on LAN1 and provides it.
"""
with nsfarm.lxd.Container(lxd, 'client', {"net:lan": device_map["net:lan1"]}) as container:
nsfarm.cli.Shell(container.pexpect()).run('wait4boot')
container.shell.run('wait4boot')
yield container
......
......@@ -29,7 +29,7 @@ class TestStatic(common.InternetTests):
client_board.run("uci set network.wan.gateway='172.16.1.1'")
client_board.run("uci set network.wan.dns='172.16.1.1'")
client_board.run("uci commit network")
nsfarm.cli.Shell(container.pexpect()).run('wait4network')
container.shell.run('wait4network')
client_board.run("/etc/init.d/network restart")
client_board.run("while ! ping -c1 -w1 172.16.1.1 >/dev/null; do true; done")
yield client_board
......@@ -53,7 +53,7 @@ class TestDHCP(common.InternetTests):
with nsfarm.lxd.Container(lxd, 'isp-dhcp', device_map) as container:
client_board.run("uci set network.wan.proto='dhcp'")
client_board.run("uci commit network")
nsfarm.cli.Shell(container.pexpect()).run('wait4network')
container.shell.run('wait4network')
client_board.run("/etc/init.d/network restart")
client_board.run("while ! ip route | grep -q default; do sleep 1; done")
yield client_board
......
......@@ -25,7 +25,7 @@ def fixture_attacker_container(lxd, device_map):
intentional as this way we won't poison data that much even if we send them to Sentinel network.
"""
with Container(lxd, 'attacker', device_map) as container:
Shell(container.pexpect()).run('wait4boot')
container.shell.run('wait4boot')
yield container
......
......@@ -121,7 +121,7 @@ class TestNoInternetAccess:
"""This provides DHCP server on WAN interface the router could use to autoconfigure WAN if it would want to.
"""
with Container(lxd, "isp-dhcp", device_map) as container:
Shell(container.pexpect()).run("wait4network")
container.shell.run("wait4network")
client_board.run("/etc/init.d/network restart") # Trigger network restart to force potential renew now
# Unfortunatelly we can't wait for router to pickup address as technically it should not. Instead we wait
# some amount of time we can expect it would picked up address from DHCP.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment