From: Kai Zhang <kyle at zelin.io> Signed-off-by: Kai Zhang <kyle at zelin.io> Signed-off-by: Liu Yuan <namei.unix at gmail.com> --- tests/functional/068 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/functional/068.out | 38 ++++++++++++++++++++++++++++++++++++++ tests/functional/common.rc | 15 +++++++++++++++ tests/functional/group | 1 + 4 files changed, 100 insertions(+) create mode 100755 tests/functional/068 create mode 100644 tests/functional/068.out diff --git a/tests/functional/068 b/tests/functional/068 new file mode 100755 index 0000000..a6699ec --- /dev/null +++ b/tests/functional/068 @@ -0,0 +1,46 @@ +#!/bin/bash + +# Test rejoin cluster + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_cleanup + +for i in 0 1 2; do + _start_sheep $i +done + +_wait_for_sheep 3 + +$COLLIE cluster format +sleep 1 + +# kill a non-master sheep +_kill_zk_session 1 + +# wait for rejoin +sleep 5 + +# kill a master +_kill_zk_session 0 + +# wait for rejoin +sleep 5 + +for i in 0 1 2; do + $COLLIE cluster info -p 700$i | _filter_cluster_info +done + +$COLLIE vdi create test 10M +for i in 0 1 2; do + $COLLIE vdi list | _filter_short_date +done diff --git a/tests/functional/068.out b/tests/functional/068.out new file mode 100644 index 0000000..e275e49 --- /dev/null +++ b/tests/functional/068.out @@ -0,0 +1,38 @@ +QA output created by 068 +using backend plain store +Cluster status: running, auto-recovery enabled + +Cluster created at DATE + +Epoch Time Version +DATE 5 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 4 [127.0.0.1:7001, 127.0.0.1:7002] +DATE 3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 2 [127.0.0.1:7000, 127.0.0.1:7002] +DATE 1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +Cluster status: running, auto-recovery enabled + +Cluster created at DATE + +Epoch Time Version +DATE 5 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 4 [127.0.0.1:7001, 127.0.0.1:7002] +DATE 3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 2 [127.0.0.1:7000, 127.0.0.1:7002] +DATE 1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +Cluster status: running, auto-recovery enabled + +Cluster created at DATE + +Epoch Time Version +DATE 5 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 4 [127.0.0.1:7001, 127.0.0.1:7002] +DATE 3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] +DATE 2 [127.0.0.1:7000, 127.0.0.1:7002] +DATE 1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002] + Name Id Size Used Shared Creation time VDI id Copies Tag + test 0 10 MB 0.0 MB 0.0 MB DATE 7c2b25 3 + Name Id Size Used Shared Creation time VDI id Copies Tag + test 0 10 MB 0.0 MB 0.0 MB DATE 7c2b25 3 + Name Id Size Used Shared Creation time VDI id Copies Tag + test 0 10 MB 0.0 MB 0.0 MB DATE 7c2b25 3 diff --git a/tests/functional/common.rc b/tests/functional/common.rc index 20c8b9d..56900c9 100644 --- a/tests/functional/common.rc +++ b/tests/functional/common.rc @@ -466,5 +466,20 @@ _random() openssl enc -aes-128-cbc -pass pass:"$(date)" -nosalt < /dev/zero 2>/dev/null } +_kill_zk_session() +{ + local path="/sheepdog/member/IPv4 ip:127.0.0.1 port:700$1" + if [[ "$DRIVER" == zoo* ]]; then + ../../tools/kill_zk_session "$path" + if [ $? -ne 0 ]; then + _die "failed to kill session" + fi + else + _kill_sheep $1 + _wait_for_sheep_stop $1 + _start_sheep $1 + fi +} + # make sure this script returns success /bin/true diff --git a/tests/functional/group b/tests/functional/group index fbe091b..ab34281 100644 --- a/tests/functional/group +++ b/tests/functional/group @@ -81,3 +81,4 @@ 065 auto quick cluster md 066 auto quick cluster md 067 auto quick cluster +068 auto quick cluster -- 1.8.1.2 |