From 3eaf9f532021326a47f70046b05854d8b1819825 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 15 Jul 2022 15:21:40 +1000 Subject: tests: Correct determination of host interface name in tests By default, passt itself attaches to the first host interface with a default route. However, when determining the host interface name the tests implicitly select the *last* host interface: they use a jq expression which will list all interfaces with default routes, but the way output detection works in the scripts, it will only pick up the last line. If there are multiple interfaces with default routes on the host, and they each have a different address, this can cause spurious test failures. Signed-off-by: David Gibson --- test/two_guests/basic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/two_guests') diff --git a/test/two_guests/basic b/test/two_guests/basic index cf0b975..f7c016d 100644 --- a/test/two_guests/basic +++ b/test/two_guests/basic @@ -18,7 +18,7 @@ htools ip jq md5sum cut test Interface names g1out IFNAME1 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname' g2out IFNAME2 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname' -hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev' +hout HOST_IFNAME ip -j -4 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]' check [ -n "__IFNAME1__" ] check [ -n "__IFNAME2__" ] -- cgit v1.2.3