diff mbox series

[ovs-dev,09/12] tests: Removed macro reset_iface_pcap_file

Message ID 20221202135137.1728564-10-xsimonar@redhat.com
State Accepted
Headers show
Series Fixes to multiple Unit and System Tests | expand

Checks

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

Commit Message

Xavier Simonart Dec. 2, 2022, 1:51 p.m. UTC
reset_iface_pcap_file and reset_pcap_file do almost exactly the
same thing. reset_iface_pcap_file adds "wait while the pcap file
has the size of the PCAP header". This adds some quite long delay
to the test (the time to receive garp).
While replacing reset_iface_pcap_file by reset_pcap_file, some
tests fail as they are now much faster, and dummy packets might be
generated before all flows are installed. Those tests are fixed by
waiting bfd to be up (causing the last flows to be installed).

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/ovn-macros.at | 21 ---------------------
 tests/ovn.at        | 19 +++++++++++++------
 2 files changed, 13 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index ee6e09d39..03c5bd3da 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -516,27 +516,6 @@  wait_for_ports_up() {
     fi
 }
 
-# reset_iface_pcap_file iface pcap_file
-# Resets the pcap file associates with OVS interface.  should be used
-# with dummy datapath.
-#
-# XXX: This should actually replace reset_pcap_file() as they do almost
-# exactly the same thing but the "wait while the pcap file has the size
-# of the PCAP header" check causes tests to fail.
-reset_iface_pcap_file() {
-    local iface=$1
-    local pcap_file=$2
-    check rm -f dummy-*.pcap
-    check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
-options:rxq_pcap=dummy-rx.pcap
-    OVS_WAIT_WHILE([test 24 = $(wc -c dummy-tx.pcap | cut -d " " -f1)])
-    check rm -f ${pcap_file}*.pcap
-    check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
-options:rxq_pcap=${pcap_file}-rx.pcap
-
-    OVS_WAIT_WHILE([test 24 = $(wc -c ${pcap_file}-tx.pcap | cut -d " " -f1)])
-}
-
 # reset_pcap_file iface pcap_file
 # Resets the pcap file associates with OVS interface.  should be used
 # with dummy datapath.
diff --git a/tests/ovn.at b/tests/ovn.at
index b540920b4..dcc74649e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -11206,13 +11206,13 @@  test_ip_packet()
     echo $expected > ext1-vif1.expected
     exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101
     echo $exp_gw_ip_garp >> ext1-vif1.expected
-    as $active_gw reset_iface_pcap_file br-phys_n1 $active_gw/br-phys_n1
+    as $active_gw reset_pcap_file br-phys_n1 $active_gw/br-phys_n1
 
     if test $backup_vswitchd_dead != 1; then
         # Reset the file only if vswitchd in backup gw is alive
-        as $backup_gw reset_iface_pcap_file br-phys_n1 $backup_gw/br-phys_n1
+        as $backup_gw reset_pcap_file br-phys_n1 $backup_gw/br-phys_n1
     fi
-    as ext1 reset_iface_pcap_file ext1-vif1 ext1/vif1
+    as ext1 reset_pcap_file ext1-vif1 ext1/vif1
 
     # Resend packet from foo1 to outside1
     check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
@@ -11249,6 +11249,10 @@  test_ip_packet()
     fi
 }
 
+# Wait for BFD to be up, then for ovn-controller to handle that change
+ovn_wait_for_bfd_up hv1 gw1 gw2
+check ovn-nbctl --wait=hv sync
+
 test_ip_packet gw1 gw2 0
 
 AT_CHECK(
@@ -11489,9 +11493,9 @@  grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1
     exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101
     echo $exp_gw_ip_garp >> ext1-vif1.expected
 
-    as $active_gw reset_iface_pcap_file br-phys_n1 $active_gw/br-phys_n1
-    as $backup_gw reset_iface_pcap_file br-phys_n1 $backup_gw/br-phys_n1
-    as ext1 reset_iface_pcap_file ext1-vif1 ext1/vif1
+    as $active_gw reset_pcap_file br-phys_n1 $active_gw/br-phys_n1
+    as $backup_gw reset_pcap_file br-phys_n1 $backup_gw/br-phys_n1
+    as ext1 reset_pcap_file ext1-vif1 ext1/vif1
 
     # Resend packet from foo1 to outside1
     check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
@@ -11506,6 +11510,9 @@  grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1
     AT_CHECK([grep $expected packets | sort], [0], [])
 }
 
+# Wait for BFD to be up, then for ovn-controller to handle that change
+ovn_wait_for_bfd_up hv1 gw1 gw2
+check ovn-nbctl --wait=hv sync
 test_ip_packet gw1 gw2
 
 AT_CHECK([ovn-nbctl --wait=hv \