diff mbox series

[ovs-dev,v5,7/8] tests: Improve "ARP/ND request broadcast limiting" test.

Message ID 20201112014559.1494128-8-blp@ovn.org
State Accepted
Headers show
Series Add DDlog implementation of ovn-northd | expand

Commit Message

Ben Pfaff Nov. 12, 2020, 1:45 a.m. UTC
This test wasn't entirely reliable because sometimes more than one
packet could get sent, but it only checked for exactly "n_packets=1".
This fixes the problem and improves the debuggability by producing
more output on failure.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/ovn.at | 45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

Comments

Dumitru Ceara Nov. 12, 2020, 11:25 a.m. UTC | #1
On 11/12/20 2:45 AM, Ben Pfaff wrote:
> This test wasn't entirely reliable because sometimes more than one
> packet could get sent, but it only checked for exactly "n_packets=1".
> This fixes the problem and improves the debuggability by producing
> more output on failure.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks,
Dumitru
Ben Pfaff Nov. 12, 2020, 6:12 p.m. UTC | #2
On Thu, Nov 12, 2020 at 12:25:38PM +0100, Dumitru Ceara wrote:
> On 11/12/20 2:45 AM, Ben Pfaff wrote:
> > This test wasn't entirely reliable because sometimes more than one
> > packet could get sent, but it only checked for exactly "n_packets=1".
> > This fixes the problem and improves the debuggability by producing
> > more output on failure.
> > 
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks, applied to master.
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 9493bca6e8e1..3d2b7a7989a7 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -19833,18 +19833,22 @@  match_arp_req="priority=80.*${match_sw_metadata}.*arp_tpa=10.0.0.1,arp_op=1"
 match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15"
 match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15"
 
+for var in sw_dp_uuid sw_dp_key sw1_dp_key r1_dp_key r1_tnl_key r2_tnl_key \
+           match_arp_req match_send_rtr1 match_send_rtr2; do
+   AS_VAR_COPY([value], [$var])
+   echo "$var=$value"
+done
+
 as hv1
-OVS_WAIT_UNTIL([
-    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \
-    grep n_packets=1 -c)
-    test "1" = "${pkts_to_rtr1}"
-])
-OVS_WAIT_UNTIL([
-    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \
-    grep n_packets=1 -c)
-    test "0" = "${pkts_to_rtr2}"
+AT_CAPTURE_FILE([offlows])
+OVS_WAIT_FOR_OUTPUT([
+    ovs-ofctl dump-flows br-int > offlows
+    for match in "$match_send_rtr1" "$match_send_rtr2"; do
+        grep -E "$match_arp_req.*$match" offlows | grep -c 'n_packets=[[1-9]]'
+    done
+    :
+], [0], [1
+0
 ])
 
 # Inject ND_NS for ofirst router owned IP address.
@@ -19856,17 +19860,14 @@  send_nd_ns 1 0 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d
 match_nd_ns="priority=80.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::1"
 
 as hv1
-OVS_WAIT_UNTIL([
-    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \
-    grep n_packets=1 -c)
-    test "1" = "${pkts_to_rtr1}"
-])
-OVS_WAIT_UNTIL([
-    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \
-    grep n_packets=1 -c)
-    test "0" = "${pkts_to_rtr2}"
+OVS_WAIT_FOR_OUTPUT([
+    ovs-ofctl dump-flows br-int > offlows
+    for match in "$match_send_rtr1" "$match_send_rtr2"; do
+        grep -E "$match_nd_ns.*$match" offlows | grep -c 'n_packets=[[1-9]]'
+    done
+    :
+], [0], [1
+0
 ])
 
 # Configure load balancing on both routers.