Fix e2e fixture: use Table=off + manual routes to avoid wg-quick conflict

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 13:31:53 -04:00
parent 0042b3b1bb
commit 6f84a3ffe1
@@ -234,10 +234,14 @@ def wg_setup(tmp_path_factory):
# --- Write wg-quick config on the test runner --- # --- Write wg-quick config on the test runner ---
conf_path = str(tmp_path / f'{IFACE_NAME}.conf') conf_path = str(tmp_path / f'{IFACE_NAME}.conf')
# Table=off: let wg-quick create the interface without managing routes.
# We add routes manually below so that existing host routes (added by
# ensure_cell_subnet_routes) don't conflict with wg-quick's route additions.
conf = ( conf = (
f'[Interface]\n' f'[Interface]\n'
f'PrivateKey = {privkey}\n' f'PrivateKey = {privkey}\n'
f'Address = {test_peer_ip}/32\n' f'Address = {test_peer_ip}/32\n'
f'Table = off\n'
f'\n' f'\n'
f'[Peer]\n' f'[Peer]\n'
f'PublicKey = {cell2_pubkey}\n' f'PublicKey = {cell2_pubkey}\n'
@@ -253,6 +257,10 @@ def wg_setup(tmp_path_factory):
up_r = _run(['sudo', 'wg-quick', 'up', conf_path], timeout=15) up_r = _run(['sudo', 'wg-quick', 'up', conf_path], timeout=15)
assert up_r.returncode == 0, f'wg-quick up failed: {up_r.stderr}\n{up_r.stdout}' assert up_r.returncode == 0, f'wg-quick up failed: {up_r.stderr}\n{up_r.stdout}'
# --- Add routes manually (replace is idempotent, handles pre-existing routes) ---
for subnet in allowed_ips.split(','):
_run(['sudo', 'ip', 'route', 'replace', subnet.strip(), 'dev', IFACE_NAME], timeout=5)
time.sleep(3) time.sleep(3)
yield { yield {