Skip to content

Commit b7ffb3e

Browse files
committed
test: the existing-bridge path reconciles addresses on purpose
`test_existing_bridge_is_not_rebuilt` asserted the reconcile path performs no `addr flush`. It now does, deliberately: without it NetworkManager's re-applied address stays on the member alongside the bridge, which is the fault the previous commit fixes. The invariant the test was actually protecting — a working bridge is not torn down and rebuilt, which would drop every client on the LAN — is asserted directly instead, and the address reconciliation gets a test of its own. Committed and pushed with this red, having chained the commit after pytest without checking it.
1 parent 0f110f7 commit b7ffb3e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

backend/tests/test_router_mode.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,10 +1022,24 @@ def test_failed_enslave_puts_the_address_back(self, monkeypatch):
10221022
assert "link delete br-lan" in joined
10231023

10241024
def test_existing_bridge_is_not_rebuilt(self, monkeypatch):
1025+
"""Reconciled, not recreated: tearing a working bridge down and
1026+
building it again would drop every client on the LAN."""
10251027
wifi, calls = self._capture(monkeypatch, exists=True)
10261028
res = wifi.create_lan_bridge("eth1", "192.168.10.1/24")
10271029
assert res["created"] is False
1028-
assert not any(c.startswith("addr flush") for c in calls)
1030+
assert not any(c.startswith("link add name") for c in calls)
1031+
assert not any(c.startswith("link delete") for c in calls)
1032+
1033+
def test_existing_bridge_still_reconciles_member_addresses(self, monkeypatch):
1034+
"""It does flush the members, though. NetworkManager re-applies a
1035+
profile's address the moment the bridge takes it, so re-applying
1036+
settings is exactly when a member has had time to pick the gateway
1037+
address back up — leaving it on both."""
1038+
wifi, calls = self._capture(monkeypatch, exists=True)
1039+
wifi.create_lan_bridge("eth1", "192.168.10.1/24")
1040+
assert "addr flush dev eth1" in calls
1041+
assert any(c.startswith("addr replace 192.168.10.1/24 dev br-lan")
1042+
for c in calls)
10291043

10301044
def test_removal_returns_the_address_to_the_wired_port(self, monkeypatch):
10311045
wifi, calls = self._capture(monkeypatch, exists=True)

0 commit comments

Comments
 (0)