aboutgitcodebugslistschat
path: root/test/ndp
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-08-18 16:13:54 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-08-20 19:07:12 +0200
commit5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c (patch)
tree13eed7d42c1a3b2076dcf89f3bf28c400c71d6ad /test/ndp
parent2fa308ac6e5723241dd433e1610395054f7b7b10 (diff)
downloadpasst-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar.gz
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar.bz2
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar.lz
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar.xz
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.tar.zst
passt-5beef085978e7ab8edc0f8a2b2a4d91a44ba2a3c.zip
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>
Diffstat (limited to 'test/ndp')
-rw-r--r--test/ndp/passt4
-rw-r--r--test/ndp/pasta2
2 files changed, 3 insertions, 3 deletions
diff --git a/test/ndp/passt b/test/ndp/passt
index 8ef15e7..c73fd4d 100644
--- a/test/ndp/passt
+++ b/test/ndp/passt
@@ -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__ ]
diff --git a/test/ndp/pasta b/test/ndp/pasta
index 28fdd72..d776055 100644
--- a/test/ndp/pasta
+++ b/test/ndp/pasta
@@ -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__ ]