diff --git a/tests/e2e/wg/test_cell_to_cell_routing.py b/tests/e2e/wg/test_cell_to_cell_routing.py index e74e95e..c58040c 100644 --- a/tests/e2e/wg/test_cell_to_cell_routing.py +++ b/tests/e2e/wg/test_cell_to_cell_routing.py @@ -234,10 +234,14 @@ def wg_setup(tmp_path_factory): # --- Write wg-quick config on the test runner --- 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 = ( f'[Interface]\n' f'PrivateKey = {privkey}\n' f'Address = {test_peer_ip}/32\n' + f'Table = off\n' f'\n' f'[Peer]\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) 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) yield {