From 82cc11a557b4f60779e8c0789aca3517eb93864b Mon Sep 17 00:00:00 2001 From: Lionel Jouin Date: Tue, 1 Oct 2024 00:01:55 +0200 Subject: [PATCH] Ignore link-local routes in SBR tests The tests were flaky due to a route with the link-local IP being automatically added after the test run saves the initial state (routes before SBR plugin is ran). When the SBR plugin is ran, the new state is compared with the old state. The new state will then contain the route with the link-local IP (that has been added after saving the old state), the old state was not containing it, so the tests were failing The solution here is to ignore routes with the link-local IP for the tests. fixes: #1096 Signed-off-by: Lionel Jouin --- plugins/meta/sbr/sbr_linux_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/meta/sbr/sbr_linux_test.go b/plugins/meta/sbr/sbr_linux_test.go index fdc9d6e2b..d800143a5 100644 --- a/plugins/meta/sbr/sbr_linux_test.go +++ b/plugins/meta/sbr/sbr_linux_test.go @@ -117,11 +117,16 @@ func readback(targetNs ns.NetNS, devNames []string) (netStatus, error) { return err } + routesNoLinkLocal := []netlink.Route{} for _, route := range routes { + if route.Dst.IP.IsLinkLocalMulticast() || route.Dst.IP.IsLinkLocalUnicast() { + continue + } log.Printf("Got %s route %v", name, route) + routesNoLinkLocal = append(routesNoLinkLocal, route) } - retVal.Devices[i].Routes = routes + retVal.Devices[i].Routes = routesNoLinkLocal } rules, err := netlink.RuleList(netlink.FAMILY_ALL)