mirror of
https://passt.top/passt
synced 2025-05-23 17:55:34 +02:00
test: Only select a single interface or gateway in tests
The queries we use in the test scripts to locate the external interface or gateway can return multiple results. We get away with this because the way we parse command output only looks at the last line. It's not really correct, though, and improvements to our handling of command output will mean it breaks. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
2fa308ac6e
commit
5beef08597
4 changed files with 7 additions and 7 deletions
|
@ -17,7 +17,7 @@ htools ip jq sipcalc grep cut
|
|||
test Interface name
|
||||
gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
|
||||
guest ip link set dev __IFNAME__ up && sleep 2
|
||||
hout HOST_IFNAME6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").dev'
|
||||
hout HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]'
|
||||
check [ -n "__IFNAME__" ]
|
||||
|
||||
test SLAAC: prefix
|
||||
|
@ -29,5 +29,5 @@ check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
|
|||
|
||||
test SLAAC: route
|
||||
gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||
hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||
hout HOST_GW6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").gateway] | .[0]'
|
||||
check [ __GW6__ = __HOST_GW6__ ]
|
||||
|
|
|
@ -29,5 +29,5 @@ check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
|
|||
|
||||
test SLAAC: route
|
||||
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||
hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||
hout HOST_GW6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").gateway] | .[0]'
|
||||
check [ __GW6__ = __HOST_GW6__ ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue