diff mbox series

[ovs-dev,v2] ovn.at: Fix flaky test "controller I-P handling with monitoring disabled".

Message ID 20210927111618.761303-1-xsimonar@redhat.com
State Accepted
Headers show
Series [ovs-dev,v2] ovn.at: Fix flaky test "controller I-P handling with monitoring disabled". | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_ovn-kubernetes success github build: passed
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Xavier Simonart Sept. 27, 2021, 11:16 a.m. UTC
Test was waiting for port to be up in SBDB before checking number of flows
in OVS. However, with conditional monitoring, there is no guarantee that all
flows are installed in OVS when port is up.
In addition, in both conditional monitoring and monitor-all cases, ARP
reponder flows are installed when port is detected up.
Hence, test was randomly failing as some flows were installed, but not all.
To fix this, we wait until the ARP related flows are installed.
Also fixed small typo in logging (for the same test).

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2004390
Fixes: f8a81693b0 ("ovn-controller: Fix the missing flows with monitor-all set to True")
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/ovn.at | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 172b5c713..080991b89 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -23698,6 +23698,12 @@  ovs-vsctl -- add-port br-int hv1-vif1 -- \
 
 wait_for_ports_up sw0-p1
 
+# Wait for last flow to be installed
+OVS_WAIT_UNTIL([
+    test $(as hv1 ovs-ofctl dump-flows br-int | \
+    grep "arp_tpa=10.0.0.3,arp_op=1" -c) -eq 2
+])
+
 # Get the number of OF flows in hv1 and hv2
 hv1_offlows=$(as hv1 ovs-ofctl dump-flows br-int | wc -l)
 echo "hv1 flows : $hv1_offlows"
@@ -23712,6 +23718,12 @@  ovs-vsctl -- add-port br-int hv2-vif1 -- \
 
 wait_for_ports_up sw0-p2
 
+# Wait for last flow to be installed
+OVS_WAIT_UNTIL([
+    test $(as hv2 ovs-ofctl dump-flows br-int | \
+    grep "arp_tpa=10.0.0.4,arp_op=1" -c) -eq 2
+])
+
 hv2_offlows=$(as hv2 ovs-ofctl dump-flows br-int | wc -l)
 echo "hv2 flows : $hv2_offlows"
 AT_CHECK([test $hv2_offlows -gt 0])
@@ -23750,9 +23762,15 @@  ovs-vsctl -- add-port br-int hv1-vif1 -- \
 
 wait_for_ports_up sw0-p1
 
+# Wait for last flow to be installed
+OVS_WAIT_UNTIL([
+    test $(as hv1 ovs-ofctl dump-flows br-int | \
+    grep "arp_tpa=10.0.0.3,arp_op=1" -c) -eq 2
+])
+
 # Get the number of OF flows in hv1 and hv2
 hv1_offlows_mon=$(as hv1 ovs-ofctl dump-flows br-int | wc -l)
-echo "hv1 flows after monitor-all=true : $hv1_offlows"
+echo "hv1 flows after monitor-all=true : $hv1_offlows_mon"
 AT_CHECK([test "$hv1_offlows" = "$hv1_offlows_mon"])
 
 as hv2
@@ -23764,8 +23782,14 @@  ovs-vsctl -- add-port br-int hv2-vif1 -- \
 
 wait_for_ports_up sw0-p2
 
+# Wait for last flow to be installed
+OVS_WAIT_UNTIL([
+    test $(as hv2 ovs-ofctl dump-flows br-int | \
+    grep "arp_tpa=10.0.0.4,arp_op=1" -c) -eq 2
+])
+
 hv2_offlows_mon=$(as hv2 ovs-ofctl dump-flows br-int | wc -l)
-echo "hv2 flows after monitor-all=true : $hv2_offlows"
+echo "hv2 flows after monitor-all=true : $hv2_offlows_mon"
 AT_CHECK([test "$hv2_offlows" = "$hv2_offlows_mon"])
 
 OVN_CLEANUP([hv1], [hv2])