Hi Mohammad,

The test provided in this patch doesn't really test that --wait does what it claims.

The test performs a --wait=sb sync, and then it checks that the nb_ic_cfg and sb_ic_cfg are now equal. The problem is that this check could succeed even without the sync command. It doesn't really prove that the sync will wait for the SB to be updated.

I suggest the following instead:

Run `ovn-appctl -t ovn-ic pause`. Now in a subshell, run the sync command. For some arbitrary time period, ensure that the sync command has not exited yet. Now from the main shell, unpause ovn-ic: `ovn-appctl -t ovn-ic resume` . Now the sync should complete. This ensures the command actually waits for the ovn-ic process to propagate the change to the ISB database. Then once that completes, check that the nb_ic_cfg and sb_ic_cfg are equal.

On 12/20/23 10:28, Mohammad Heib wrote:
add unit test that check validate that sync command
sync ISB properly

Signed-off-by: Mohammad Heib <mh...@redhat.com>
---
  tests/ovn-ic.at | 22 ++++++++++++++++++++++
  1 file changed, 22 insertions(+)

diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index d4c436f84..da7c37817 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -1274,3 +1274,25 @@ OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
  ])
+
+AT_SETUP([ovn-ic -- sync ISB status to INB])
+ovn_init_ic_db
+net_add n1
+
+ovn_start az1
+sim_add gw-az1
+as gw-az1
+
+check ovs-vsctl add-br br-phys
+ovn_az_attach az1 n1 br-phys 192.168.1.1
+check ovs-vsctl set open . external-ids:ovn-is-interconn=true
+
+ovn-ic-nbctl --wait=sb sync
+set -- $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg sb_ic_cfg)
+AS_VAR_SET([ic_nb_cfg], [$1])
+AS_VAR_SET([ic_sb_cfg], [$2])
+check test $ic_nb_cfg == $ic_sb_cfg
+
+OVN_CLEANUP_IC([az1])
+AT_CLEANUP
+])

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to