summaryrefslogtreecommitdiff
path: root/tests/ovsdb-cluster.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ovsdb-cluster.at')
-rw-r--r--tests/ovsdb-cluster.at55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index fc6253cfe..07af1160f 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -400,6 +400,61 @@ done
AT_CLEANUP
+AT_BANNER([OVSDB - cluster failure while joining])
+AT_SETUP([OVSDB cluster - follower crash while joining])
+AT_KEYWORDS([ovsdb server negative unix cluster join])
+
+n=3
+schema_name=`ovsdb-tool schema-name $abs_srcdir/idltest.ovsschema`
+ordinal_schema > schema
+AT_CHECK([ovsdb-tool '-vPATTERN:console:%c|%p|%m' create-cluster s1.db dnl
+ $abs_srcdir/idltest.ovsschema unix:s1.raft], [0], [], [stderr])
+cid=`ovsdb-tool db-cid s1.db`
+schema_name=`ovsdb-tool schema-name $abs_srcdir/idltest.ovsschema`
+for i in `seq 2 $n`; do
+ AT_CHECK([ovsdb-tool join-cluster s$i.db $schema_name unix:s$i.raft unix:s1.raft])
+done
+
+on_exit 'kill `cat *.pid`'
+
+dnl Starting followers first, so we can configure them to crash on join.
+for j in `seq $n`; do
+ i=$(($n + 1 - $j))
+ AT_CHECK([ovsdb-server -v -vconsole:off -vsyslog:off dnl
+ --detach --no-chdir --log-file=s$i.log dnl
+ --pidfile=s$i.pid --unixctl=s$i dnl
+ --remote=punix:s$i.ovsdb s$i.db])
+ if test $i != 1; then
+ OVS_WAIT_UNTIL([ovs-appctl -t "`pwd`"/s$i dnl
+ cluster/failure-test crash-before-sending-install-snapshot-reply dnl
+ | grep -q "engaged"])
+ fi
+done
+
+dnl Make sure that followers really crashed.
+for i in `seq 2 $n`; do
+ OVS_WAIT_WHILE([test -s s$i.pid])
+done
+
+dnl Bring them back.
+for i in `seq 2 $n`; do
+ AT_CHECK([ovsdb-server -v -vconsole:off -vsyslog:off dnl
+ --detach --no-chdir --log-file=s$i.log dnl
+ --pidfile=s$i.pid --unixctl=s$i dnl
+ --remote=punix:s$i.ovsdb s$i.db])
+done
+
+dnl Make sure that all servers joined the cluster.
+for i in `seq $n`; do
+ AT_CHECK([ovsdb_client_wait unix:s$i.ovsdb $schema_name connected])
+done
+
+for i in `seq $n`; do
+ OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/s$i], [s$i.pid])
+done
+
+AT_CLEANUP
+
OVS_START_SHELL_HELPERS