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 <david@gibson.dropbear.id.au>
This commit is contained in:
parent
4b2e018d70
commit
3eaf9f5320
2 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@ htools ip jq sed tr head
|
|||
|
||||
test Interface name
|
||||
gout IFNAME 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 "__IFNAME__" ]
|
||||
|
||||
test DHCP: address
|
||||
|
|
|
@ -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__" ]
|
||||
|
||||
|
|
Loading…
Reference in a new issue