test-network: add test case for issue #31165

This commit is contained in:
Yu Watanabe 2024-02-02 11:20:25 +09:00
parent c3e12de0a6
commit 2bb1d3c108
2 changed files with 8 additions and 0 deletions

View file

@ -1046,6 +1046,8 @@ static int link_up_or_down(Link *link, bool up, Request *req) {
assert(link->manager->rtnl);
assert(req);
/* The log message is checked in the test. Please also update test_bond_active_slave() in
* test/test-network/systemd-networkd-tests.py. when the log message below is modified. */
log_link_debug(link, "Bringing link %s", up_or_down(up));
r = sd_rtnl_message_new_link(link->manager->rtnl, &m, RTM_SETLINK, link->ifindex);

View file

@ -4597,6 +4597,12 @@ class NetworkdBondTests(unittest.TestCase, Utilities):
print(output)
self.assertIn('active_slave dummy98', output)
# test case for issue #31165.
since = datetime.datetime.now()
networkctl_reconfigure('dummy98')
self.wait_online(['dummy98:enslaved', 'bond199:degraded'])
self.assertNotIn('dummy98: Bringing link down', read_networkd_log(since=since))
def test_bond_primary_slave(self):
copy_network_unit('23-primary-slave.network', '23-bond199.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev')
start_networkd()