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 <lionel.jouin@est.tech>
This commit is contained in:
Lionel Jouin 2024-10-01 00:01:55 +02:00 committed by Casey Callendrello
parent fa737f82b2
commit c11ed48733

View File

@ -117,11 +117,16 @@ func readback(targetNs ns.NetNS, devNames []string) (netStatus, error) {
return err return err
} }
routesNoLinkLocal := []netlink.Route{}
for _, route := range routes { for _, route := range routes {
if route.Dst.IP.IsLinkLocalMulticast() || route.Dst.IP.IsLinkLocalUnicast() {
continue
}
log.Printf("Got %s route %v", name, route) 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) rules, err := netlink.RuleList(netlink.FAMILY_ALL)