diff mbox series

[ovs-dev,v2,2/5] tests: Fix macros waiting for flows.

Message ID 20241014101046.3309426-3-xsimonar@redhat.com
State New
Headers show
Series Peer ports. | 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 Oct. 14, 2024, 10:10 a.m. UTC
Those macros were, in some cases, returning before the proper flows
were installed, for instance when no ofport was yet created.
Hence tests might sometimes have been flaky.
This also highlited an issue in a test which also got fixed.

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

Patch

diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 0f9a3ab09..caa89ab47 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -109,7 +109,7 @@  m4_divert_text([PREPARE_TESTS],
          OVS_WAIT_UNTIL([
              hv_patch_ofport=$(as $hv ovs-vsctl --bare --columns ofport find Interface name=$patch_port)
              echo "$patch_port=$hv_patch_ofport"
-             test 1 -le $(as $hv ovs-ofctl dump-flows br-int | grep -c "output:\b$hv_patch_ofport\b")
+             test -n "$hv_patch_ofport" && test 1 -le $(as $hv ovs-ofctl dump-flows br-int | grep -c "output:\b$hv_patch_ofport\b")
          ])
        done
      done
@@ -123,7 +123,7 @@  m4_divert_text([PREPARE_TESTS],
      OVS_WAIT_UNTIL([
          ofport=$(as $hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-${hv2}-0)
          echo "tunnel port=$ofport"
-         test 1 -le $(as $hv1 ovs-ofctl dump-flows br-int | grep -c "output:$ofport")
+         test -n "$ofport" && test 1 -le $(as $hv1 ovs-ofctl dump-flows br-int | grep -c "output:$ofport")
      ])
    }
 
@@ -135,7 +135,7 @@  m4_divert_text([PREPARE_TESTS],
      OVS_WAIT_UNTIL([
          ofport=$(as $hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-${hv2}-0)
          echo "tunnel port=$ofport"
-         test 1 -le $(as $hv1 ovs-ofctl dump-flows br-int | grep -c "in_port=$ofport")
+         test -n "$ofport" && test 1 -le $(as $hv1 ovs-ofctl dump-flows br-int | grep -c "in_port=$ofport")
      ])
    }
 
diff --git a/tests/ovn.at b/tests/ovn.at
index e3c25be53..a82e152b4 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -15361,8 +15361,8 @@  OVN_WAIT_PATCH_PORT_FLOWS(["public"], ["hv1"])
 OVN_WAIT_PATCH_PORT_FLOWS(["public"], ["hv2"])
 OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv1"],["hv2"])
 OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv2"],["hv1"])
-OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv3"],[hv1"])
-OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv3"],[hv2"])
+OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv3"],["hv1"])
+OVN_WAIT_REMOTE_OUTPUT_FLOWS(["hv3"],["hv2"])
 
 wait_column "$hv1_uuid" Port_Binding chassis logical_port=migrator
 wait_column "$hv1_uuid" Port_Binding requested_chassis logical_port=migrator