CHECK_AFTER_RECOMPUTE and CHECK_FLOWS_AFTER_RECOMPUTE macros compare
flows before and after recompute, and report test failure if those flows
are different.
However, learned flows can happen at any time e.g. due to IPv6 Router
Solicitation. If the test is long they might also be deleted.
So, ignore learned flows when comparing flows before and after recompute.

See for instance [0] for a test failing for this reason.

[0] 
https://github.com/ovsrobot/ovn/actions/runs/32723237137/job/97422492101#step:12:5869

Signed-off-by: Xavier Simonart <[email protected]>

---
v2: - Rebase on origin/main.
    - Update based on Ales' feedback i.e. also skip hard_timeout.
    - Minor updates (grammar) to commit message.
---
 tests/ovn-macros.at | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 560f02fc1..cfa6093ec 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -308,7 +308,11 @@ m4_define([CHECK_FLOWS_AFTER_RECOMPUTE], [
           check ovn-nbctl --wait=hv sync
       fi
       DUMP_FLOWS([$sbox], [flows-$hv-after])
-      diff flows-$hv-before flows-$hv-after > flow-diff
+      # Avoid learned flows i.e. flows with idle_timeout and no learn.
+      diff flows-$hv-before flows-$hv-after |
+          grep "^[<>]" |
+          awk '(!/idle_timeout=/ && !/hard_timeout=/) || /learn/' > flow-diff
+
       AT_CHECK([wc -l < flow-diff], [0], [0
 ])
     fi
@@ -388,7 +392,10 @@ m4_define([CHECK_AFTER_RECOMPUTE], [
 ])
 
       # Compare and store flow differences before and after recompute
-      diff -u flows-$hv-before flows-$hv-after | grep "^+ \|^- " > 
flow-diff-$hv
+      # Avoid learned flows i.e. flows with idle_timeout and no learn.
+      diff -u flows-$hv-before flows-$hv-after |
+          grep "^+ \|^- " |
+          awk '(!/idle_timeout=/ && !/hard_timeout=/) || /learn/' > 
flow-diff-$hv
       if [[ -n "$related_ports" ]]; then
         tag=$(ovn-sbctl --bare --columns tag list port_binding $related_ports)
         if [[ -n "$tag" ]]; then
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to