From d9124e4366d2d87921c780f9f22c2d926cfb10fa Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Fri, 6 Nov 2026 22:51:44 -0600 Subject: [PATCH] Bring up sandbox client loopback --- scripts/network-sandbox-lifecycle-host.py | 1 + tests/jeannie/test_network_sandbox_lifecycle.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/network-sandbox-lifecycle-host.py b/scripts/network-sandbox-lifecycle-host.py index 4a21b7a..baf144e 100644 --- a/scripts/network-sandbox-lifecycle-host.py +++ b/scripts/network-sandbox-lifecycle-host.py @@ -78,6 +78,7 @@ def status(command, guest): def ensure_client_network(guest): """Obtain a DHCP lease with direct pct exec arguments, without a shell.""" prefix = ('pct', 'exec', str(guest), '--') + run(*prefix, 'ip', 'link', 'set', 'dev', 'lo', 'up') run(*prefix, 'ip', 'link', 'set', 'dev', 'eth0', 'up') address = run(*prefix, 'ip', '-4', 'addr', 'show', 'dev', 'eth0') if 'inet ' in address: diff --git a/tests/jeannie/test_network_sandbox_lifecycle.py b/tests/jeannie/test_network_sandbox_lifecycle.py index cb7d09f..8b55ab0 100644 --- a/tests/jeannie/test_network_sandbox_lifecycle.py +++ b/tests/jeannie/test_network_sandbox_lifecycle.py @@ -34,10 +34,11 @@ class SandboxLifecycleTests(unittest.TestCase): lifecycle.verify_guests() def test_start_network_targets_only_the_selected_client(self): - with patch.object(lifecycle, 'run', side_effect=['', '', '', 'inet 172.29.210.101/24']) as command: + with patch.object(lifecycle, 'run', side_effect=['', '', '', '', 'inet 172.29.210.101/24']) as command: lifecycle.ensure_client_network(9110) calls = [entry.args for entry in command.call_args_list] self.assertTrue(all(args[:4] == ('pct', 'exec', '9110', '--') for args in calls)) + self.assertIn(('pct', 'exec', '9110', '--', 'ip', 'link', 'set', 'dev', 'lo', 'up'), calls) self.assertIn(('pct', 'exec', '9110', '--', 'busybox', 'udhcpc', '-n', '-t', '3', '-T', '2', '-i', 'eth0', '-s', '/usr/share/udhcpc/default.script'), calls)