git: 79748cec1f1c - main - tests: fix netlink test_dump_ifaces_many test.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Feb 2023 22:28:24 UTC
The branch main has been updated by melifaro:
URL: https://cgit.FreeBSD.org/src/commit/?id=79748cec1f1c3437e49d7694e95fc7f438336805
commit 79748cec1f1c3437e49d7694e95fc7f438336805
Author: Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-02-18 22:26:32 +0000
Commit: Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-02-18 22:28:01 +0000
tests: fix netlink test_dump_ifaces_many test.
Consider only loopback interfaces when counting.
Otherwise, if pf is loaded, 'pflog0' gets added to the vnet,
breaking the test.
MFC after: 2 weeks
---
tests/sys/netlink/test_rtnl_iface.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/sys/netlink/test_rtnl_iface.py b/tests/sys/netlink/test_rtnl_iface.py
index cbe5aed8b8ae..35015ea2ec6e 100644
--- a/tests/sys/netlink/test_rtnl_iface.py
+++ b/tests/sys/netlink/test_rtnl_iface.py
@@ -247,9 +247,7 @@ class TestRtNlIface(NetlinkTestTemplate, SingleVnetTestTemplate):
"""Tests if interface dummp is not missing interfaces"""
ifmap = {}
- for ifname in (self.vnet.iface_alias_map["if1"].name, "lo0"):
- ifindex = socket.if_nametoindex(ifname)
- ifmap[ifindex] = ifname
+ ifmap[socket.if_nametoindex("lo0")] = "lo0"
for i in range(40):
ifname = "lo{}".format(i + 1)
@@ -300,7 +298,9 @@ class TestRtNlIface(NetlinkTestTemplate, SingleVnetTestTemplate):
ifindex = rx_msg.base_hdr.ifi_index
assert ifindex == rx_msg.base_hdr.ifi_index
- kernel_ifmap[ifindex] = rx_msg.get_nla(IflattrType.IFLA_IFNAME).text
+ ifname = rx_msg.get_nla(IflattrType.IFLA_IFNAME).text
+ if ifname.startswith("lo"):
+ kernel_ifmap[ifindex] = ifname
assert kernel_ifmap == ifmap
#