diff mbox series

[ovs-dev,2/3] tests: Fixed wrong usage of OVS_WAIT_UNTIL

Message ID 20230420161455.134493-2-xsimonar@redhat.com
State Accepted
Headers show
Series [ovs-dev,1/3] tests: Fixed "1 LR with HA distributed router gateway port" | 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 fail github build: failed

Commit Message

Xavier Simonart April 20, 2023, 4:14 p.m. UTC
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/ovn-controller.at | 19 ++++++++++++-------
 tests/ovn.at            | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 19 deletions(-)

Comments

Ales Musil April 21, 2023, 7:57 a.m. UTC | #1
On Thu, Apr 20, 2023 at 6:15 PM Xavier Simonart <xsimonar@redhat.com> wrote:

> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
> ---
>  tests/ovn-controller.at | 19 ++++++++++++-------
>  tests/ovn.at            | 24 ++++++++++++------------
>  2 files changed, 24 insertions(+), 19 deletions(-)
>
> diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
> index 597aed00b..137724723 100644
> --- a/tests/ovn-controller.at
> +++ b/tests/ovn-controller.at
> @@ -493,7 +493,8 @@ check ovn-nbctl --wait=hv sync
>
>  # And check that it gets propagated to br-int external_ids.
>  as hv1
> -OVS_WAIT_UNTIL([ovs-vsctl get Bridge br-int external_ids:ovn-nb-cfg],
> [0], [1])
> +OVS_WAIT_FOR_OUTPUT([ovs-vsctl get Bridge br-int
> external_ids:ovn-nb-cfg], [0], ["1"
> +])
>
>  nb_cfg_ts=$(fetch_column Chassis_Private nb_cfg_timestamp name=hv1)
>  as hv1
> @@ -672,22 +673,26 @@ check ovs-vsctl del-ssl
>  start_daemon ovn-controller -p $key -c $cert -C $cacert
>
>  # SSL should not connect because of key and cert mismatch
> -OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0],
> [not connected])
> +OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status],
> [0], [not connected
> +])
>
>  # Modify the files with the correct key and cert, and reconnect should
> succeed
>  cp $PKIDIR/$key $key
>  cp $PKIDIR/$cert $cert
>
> -OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0],
> [connected])
> +OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status],
> [0], [connected
> +])
>
>  # Remove the files and expect the connection to drop
>  rm $key $cert
> -OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0],
> [not connected])
> +OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status],
> [0], [not connected
> +])
>
>  # Restore the files again and expect the connection to recover
>  cp $PKIDIR/$key $key
>  cp $PKIDIR/$cert $cert
> -OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0],
> [connected])
> +OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status],
> [0], [connected
> +])
>
>  cat hv1/ovn-controller.log
>
> @@ -2161,7 +2166,7 @@ AT_CHECK([ovs-ofctl dump-flows br-int | grep
> 10.1.2.3], [0], [ignore])
>  sleep 5
>
>  # Check after the wait
> -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4], [0],
> [ignore])
> +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4])
>  lflow_run_2=$(ovn-appctl -t ovn-controller coverage/read-counter
> lflow_run)
>
>  # Verify that the flow compute completed during the wait (after the wait
> it
> @@ -2172,7 +2177,7 @@ AT_CHECK_UNQUOTED([echo $lflow_run_1], [0],
> [$lflow_run_2
>  # Restart OVS this time, and wait until flows are reinstalled
>  OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
>  start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif
> -vunixctl
> -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4], [0],
> [ignore])
> +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4])
>
>  check ovn-nbctl --wait=hv lb-add lb3 2.2.2.2 10.1.2.5 \
>  -- ls-lb-add ls1 lb3
> diff --git a/tests/ovn.at b/tests/ovn.at
> index aba3e92c6..23c5d29f3 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -21236,7 +21236,7 @@ check_virtual_offlows_not_present hv2
>  send_garp 1 1 $eth_src $eth_dst $spa $tpa
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
> +logical_port=sw0-vir) = x$hv1_ch_uuid])
>
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
>  logical_port=sw0-vir) = xsw0-p1])
> @@ -21304,7 +21304,7 @@ tpa=$(ip_to_hex 10 0 0 10)
>  send_garp 1 2 $eth_src $eth_dst $spa $tpa
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
> +logical_port=sw0-vir) = x$hv1_ch_uuid])
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
>  logical_port=sw0-vir) = xsw0-p3])
> @@ -21332,7 +21332,7 @@ tpa=$(ip_to_hex 10 0 0 10)
>  send_garp 2 1 $eth_src $eth_dst $spa $tpa
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x$hv2_ch_uuid], [0], [])
> +logical_port=sw0-vir) = x$hv2_ch_uuid])
>
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
>  logical_port=sw0-vir) = xsw0-p2])
> @@ -21359,7 +21359,7 @@ tpa=$(ip_to_hex 10 0 0 4)
>  send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
> +logical_port=sw0-vir) = x$hv1_ch_uuid])
>  sleep 1
>
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
> @@ -21382,7 +21382,7 @@ check_virtual_offlows_not_present hv2
>  as hv1 ovs-vsctl del-port hv1-vif1
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x], [0], [])
> +logical_port=sw0-vir) = x])
>  sleep 1
>
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
> @@ -21412,7 +21412,7 @@ send_arp_reply 2 1 $eth_src $eth_dst $spa $tpa
>  sleep 1
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x$hv2_ch_uuid], [0], [])
> +logical_port=sw0-vir) = x$hv2_ch_uuid])
>  sleep 1
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
>  logical_port=sw0-vir) = xsw0-p2])
> @@ -21434,7 +21434,7 @@ check_virtual_offlows_not_present hv1
>  ovn-nbctl lsp-del sw0-p2
>
>  OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find
> port_binding \
> -logical_port=sw0-vir) = x], [0], [])
> +logical_port=sw0-vir) = x])
>  AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find
> port_binding \
>  logical_port=sw0-vir) = x])
>
> @@ -23836,7 +23836,7 @@ send_garp 1 1 $eth_src $eth_dst $spa $tpa
>
>  wait_row_count MAC_Binding 1
>
> -OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
> +OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
>  list mac_binding], [0], [lr0-sw0
>  10.0.0.30
>  50:54:00:00:00:03
> @@ -23883,7 +23883,7 @@ grep table_id=10 | wc -l`])
>
>  check_row_count MAC_Binding 1
>
> -OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
> +OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
>  list mac_binding], [0], [lr0-sw0
>  10.0.0.30
>  50:54:00:00:00:13
> @@ -23912,7 +23912,7 @@ OVS_WAIT_UNTIL(
>  | wc -l`]
>  )
>
> -OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
> +OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns
> logical_port,ip,mac \
>  find mac_binding ip=10.0.0.50], [0], [lr0-sw0
>  10.0.0.50
>  50:54:00:00:00:33
> @@ -27263,7 +27263,7 @@ ovn_attach n1 br-phys 192.168.0.1
>
>  # Chassis hv1 should add flows for the ls1 datapath in table 8
> (ls_in_port_sec_l2).
>  dp_key=$(ovn-sbctl --bare --columns tunnel_key list Datapath_Binding ls1)
> -OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int | grep -E
> "table=8.*metadata=0x${dp_key}"], [0], [ignore])
> +OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int | grep -E
> "table=8.*metadata=0x${dp_key}"])
>
>  OVN_CLEANUP([hv1])
>  AT_CLEANUP
> @@ -27289,7 +27289,7 @@ ovs-vsctl add-br br-phys
>  ovn_attach n1 br-phys 192.168.0.1
>
>  # Port_Binding should be released.
> -OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl show | grep Port_Binding -c)], [0])
> +OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl show | grep Port_Binding -c)])
>
>  OVN_CLEANUP([hv1])
>  AT_CLEANUP
> --
> 2.31.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks.

Acked-by: Ales Musil <amusil@redhat.com>
diff mbox series

Patch

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 597aed00b..137724723 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -493,7 +493,8 @@  check ovn-nbctl --wait=hv sync
 
 # And check that it gets propagated to br-int external_ids.
 as hv1
-OVS_WAIT_UNTIL([ovs-vsctl get Bridge br-int external_ids:ovn-nb-cfg], [0], [1])
+OVS_WAIT_FOR_OUTPUT([ovs-vsctl get Bridge br-int external_ids:ovn-nb-cfg], [0], ["1"
+])
 
 nb_cfg_ts=$(fetch_column Chassis_Private nb_cfg_timestamp name=hv1)
 as hv1
@@ -672,22 +673,26 @@  check ovs-vsctl del-ssl
 start_daemon ovn-controller -p $key -c $cert -C $cacert
 
 # SSL should not connect because of key and cert mismatch
-OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0], [not connected])
+OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status], [0], [not connected
+])
 
 # Modify the files with the correct key and cert, and reconnect should succeed
 cp $PKIDIR/$key $key
 cp $PKIDIR/$cert $cert
 
-OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0], [connected])
+OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status], [0], [connected
+])
 
 # Remove the files and expect the connection to drop
 rm $key $cert
-OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0], [not connected])
+OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status], [0], [not connected
+])
 
 # Restore the files again and expect the connection to recover
 cp $PKIDIR/$key $key
 cp $PKIDIR/$cert $cert
-OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller connection-status], [0], [connected])
+OVS_WAIT_FOR_OUTPUT([ovn-appctl -t ovn-controller connection-status], [0], [connected
+])
 
 cat hv1/ovn-controller.log
 
@@ -2161,7 +2166,7 @@  AT_CHECK([ovs-ofctl dump-flows br-int | grep 10.1.2.3], [0], [ignore])
 sleep 5
 
 # Check after the wait
-OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4], [0], [ignore])
+OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4])
 lflow_run_2=$(ovn-appctl -t ovn-controller coverage/read-counter lflow_run)
 
 # Verify that the flow compute completed during the wait (after the wait it
@@ -2172,7 +2177,7 @@  AT_CHECK_UNQUOTED([echo $lflow_run_1], [0], [$lflow_run_2
 # Restart OVS this time, and wait until flows are reinstalled
 OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
 start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl
-OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4], [0], [ignore])
+OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 10.1.2.4])
 
 check ovn-nbctl --wait=hv lb-add lb3 2.2.2.2 10.1.2.5 \
 -- ls-lb-add ls1 lb3
diff --git a/tests/ovn.at b/tests/ovn.at
index aba3e92c6..23c5d29f3 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -21236,7 +21236,7 @@  check_virtual_offlows_not_present hv2
 send_garp 1 1 $eth_src $eth_dst $spa $tpa
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
+logical_port=sw0-vir) = x$hv1_ch_uuid])
 
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
 logical_port=sw0-vir) = xsw0-p1])
@@ -21304,7 +21304,7 @@  tpa=$(ip_to_hex 10 0 0 10)
 send_garp 1 2 $eth_src $eth_dst $spa $tpa
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
+logical_port=sw0-vir) = x$hv1_ch_uuid])
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
 logical_port=sw0-vir) = xsw0-p3])
@@ -21332,7 +21332,7 @@  tpa=$(ip_to_hex 10 0 0 10)
 send_garp 2 1 $eth_src $eth_dst $spa $tpa
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x$hv2_ch_uuid], [0], [])
+logical_port=sw0-vir) = x$hv2_ch_uuid])
 
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
 logical_port=sw0-vir) = xsw0-p2])
@@ -21359,7 +21359,7 @@  tpa=$(ip_to_hex 10 0 0 4)
 send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x$hv1_ch_uuid], [0], [])
+logical_port=sw0-vir) = x$hv1_ch_uuid])
 sleep 1
 
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
@@ -21382,7 +21382,7 @@  check_virtual_offlows_not_present hv2
 as hv1 ovs-vsctl del-port hv1-vif1
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x], [0], [])
+logical_port=sw0-vir) = x])
 sleep 1
 
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
@@ -21412,7 +21412,7 @@  send_arp_reply 2 1 $eth_src $eth_dst $spa $tpa
 sleep 1
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x$hv2_ch_uuid], [0], [])
+logical_port=sw0-vir) = x$hv2_ch_uuid])
 sleep 1
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
 logical_port=sw0-vir) = xsw0-p2])
@@ -21434,7 +21434,7 @@  check_virtual_offlows_not_present hv1
 ovn-nbctl lsp-del sw0-p2
 
 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
-logical_port=sw0-vir) = x], [0], [])
+logical_port=sw0-vir) = x])
 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
 logical_port=sw0-vir) = x])
 
@@ -23836,7 +23836,7 @@  send_garp 1 1 $eth_src $eth_dst $spa $tpa
 
 wait_row_count MAC_Binding 1
 
-OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
+OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
 list mac_binding], [0], [lr0-sw0
 10.0.0.30
 50:54:00:00:00:03
@@ -23883,7 +23883,7 @@  grep table_id=10 | wc -l`])
 
 check_row_count MAC_Binding 1
 
-OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
+OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
 list mac_binding], [0], [lr0-sw0
 10.0.0.30
 50:54:00:00:00:13
@@ -23912,7 +23912,7 @@  OVS_WAIT_UNTIL(
 | wc -l`]
 )
 
-OVS_WAIT_UNTIL([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
+OVS_WAIT_FOR_OUTPUT([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
 find mac_binding ip=10.0.0.50], [0], [lr0-sw0
 10.0.0.50
 50:54:00:00:00:33
@@ -27263,7 +27263,7 @@  ovn_attach n1 br-phys 192.168.0.1
 
 # Chassis hv1 should add flows for the ls1 datapath in table 8 (ls_in_port_sec_l2).
 dp_key=$(ovn-sbctl --bare --columns tunnel_key list Datapath_Binding ls1)
-OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int | grep -E "table=8.*metadata=0x${dp_key}"], [0], [ignore])
+OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int | grep -E "table=8.*metadata=0x${dp_key}"])
 
 OVN_CLEANUP([hv1])
 AT_CLEANUP
@@ -27289,7 +27289,7 @@  ovs-vsctl add-br br-phys
 ovn_attach n1 br-phys 192.168.0.1
 
 # Port_Binding should be released.
-OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl show | grep Port_Binding -c)], [0])
+OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl show | grep Port_Binding -c)])
 
 OVN_CLEANUP([hv1])
 AT_CLEANUP