[ovs-dev] [PATCH] ovsdb-idl.at: Wait all servers to join the cluster.

Flavio Leitner fbl at sysclose.org
Wed Jun 10 23:45:38 UTC 2020


The test 'Check Python IDL reconnects to leader - Python3
(leader only)' fails sometimes when the first ovsdb-server
gets killed before the others had joined the cluster.

Fix the function ovsdb_cluster_start_idltest to wait them
to join the cluster.

Suggested-by: Ilya Maximets <i.maximets at ovn.org>
Signed-off-by: Flavio Leitner <fbl at sysclose.org>
---
 tests/ovsdb-idl.at | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index b5cbee7d9..c045e9264 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -29,6 +29,17 @@ ovsdb_cluster_start_idltest () {
      ovsdb-server -vraft -vconsole:warn --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb ${2:+--remote=$2} s$i.db || return $?
    done
    on_exit 'kill `cat s*.pid`'
+   for i in `seq $n`; do
+     for d in `seq 1 "$OVS_CTL_TIMEOUT"`; do
+       if ovs-appctl -t $(pwd)/s$i cluster/status ${schema_name} | grep -q 'Status: cluster member'; then
+         break
+       fi
+       sleep 1
+     done
+     if ! ovs-appctl -t $(pwd)/s$i cluster/status ${schema_name} | grep -q 'Status: cluster member'; then
+       return 1
+     fi
+   done
 }
 
 # ovsdb_cluster_leader [REMOTES] [DATABASE]
-- 
2.26.2



More information about the dev mailing list