diff mbox series

[ovs-dev,v2] Fix possible timing issues in OVN test cases

Message ID 20180312065057.6379-1-nusiddiq@redhat.com
State Accepted
Headers show
Series [ovs-dev,v2] Fix possible timing issues in OVN test cases | expand

Commit Message

Numan Siddique March 12, 2018, 6:50 a.m. UTC
From: Numan Siddique <nusiddiq@redhat.com>

This patch fixes timing related failures in some test cases when run with
-j option. It uses OVS_WAIT_* whereever  appropriate. It also fixes the
test case "ovn -- IPv6 periodic RA" wherein the logical port - sw-p1 is
bound on 2 chassis and this causes both the chassis to fight for the port.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
---
 tests/ovn.at | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

Comments

Ben Pfaff April 4, 2018, 11:27 p.m. UTC | #1
On Mon, Mar 12, 2018 at 12:20:57PM +0530, nusiddiq@redhat.com wrote:
> From: Numan Siddique <nusiddiq@redhat.com>
> 
> This patch fixes timing related failures in some test cases when run with
> -j option. It uses OVS_WAIT_* whereever  appropriate. It also fixes the
> test case "ovn -- IPv6 periodic RA" wherein the logical port - sw-p1 is
> bound on 2 chassis and this causes both the chassis to fight for the port.
> 
> Signed-off-by: Numan Siddique <nusiddiq@redhat.com>

Thanks.  I applied this patch to master.
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 5f985f345..eeead056d 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -7297,6 +7297,11 @@  test_ip_packet()
 
     as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply
 
+    OVS_WAIT_UNTIL([
+        test `as $active_gw ovs-ofctl dump-flows br-int | grep table=66 | \
+grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1
+    ])
+
     # Packet to Expect at ext1 chassis, outside1 port
     src_mac="000002010203"
     dst_mac="f00000010204"
@@ -7498,6 +7503,11 @@  test_ip_packet()
 
     as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply
 
+    OVS_WAIT_UNTIL([
+        test `as $active_gw ovs-ofctl dump-flows br-int | grep table=66 | \
+grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1
+    ])
+
     # Packet to Expect at ext1 chassis, outside1 port
     src_mac="000002010203"
     dst_mac="f00000010204"
@@ -9042,9 +9052,12 @@  ovs-vsctl -- add-port br-int hv1-vif1 -- \
     ofport-request=1
 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
-# Allow some time for ovn-northd and ovn-controller to catch up.
-# XXX This should be more systematic.
-sleep 1
+OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw0_ip6-port1` = xup])
+cr_uuid=`ovn-sbctl find port_binding logical_port=cr-ip6_public | grep _uuid | cut -f2 -d ":"`
+
+# There is only one chassis.
+chassis_uuid=`ovn-sbctl list chassis | grep _uuid | cut -f2 -d ":"`
+OVS_WAIT_UNTIL([test $chassis_uuid = `ovn-sbctl get port_binding $cr_uuid chassis`])
 
 trim_zeros() {
     sed 's/\(00\)\{1,\}$//'
@@ -9081,6 +9094,9 @@  src_ip=aef0000000000000526400fffe000002
 # should be received by the ports attached to br-phys.
 test_ipv6 1 $src_mac $dst_mac $src_ip 2
 
+OVS_WAIT_WHILE([test 24 = $(wc -c hv1/br-phys_n1-tx.pcap | cut -d " " -f1)])
+OVS_WAIT_WHILE([test 24 = $(wc -c hv1/br-phys-tx.pcap | cut -d " " -f1)])
+
 $PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/br-phys_n1-tx.pcap | \
 trim_zeros > 1.packets
 $PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | \
@@ -9237,17 +9253,17 @@  ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=slaac
 ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=4
 ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=3
 
-for i in hv1 hv2 ; do
-    as $i
-    ovs-vsctl -- add-port br-int $i-vif1 -- \
-        set interface $i-vif1 external-ids:iface-id=sw-p1 \
-        options:tx_pcap=$i/vif1-tx.pcap \
-        options:rxq_pcap=$i/vif1-rx.pcap \
+for i in 1 2 ; do
+    as hv$i
+    ovs-vsctl -- add-port br-int hv$i-vif1 -- \
+        set interface hv$i-vif1 external-ids:iface-id=sw-p$i \
+        options:tx_pcap=hv$i/vif1-tx.pcap \
+        options:rxq_pcap=hv$i/vif1-rx.pcap \
         ofport-request=1
 done
 
-# Allow time for ovn-northd and ovn-controller to catch up
-sleep 1
+OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw-p1` = xup])
+OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw-p2` = xup])
 
 reset_pcap_file() {
     local iface=$1