[sheepdog] [PATCH] test: add another test for sheep recovery logic

Liu Yuan namei.unix at gmail.com
Wed Aug 22 08:50:20 CEST 2012


On 08/22/2012 02:32 PM, Liu Yuan wrote:
> From: Liu Yuan <tailai.ly at taobao.com>
> 
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
>  tests/028     |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/028.out |   15 +++++++++++++++
>  tests/group   |    1 +
>  3 files changed, 76 insertions(+)
>  create mode 100755 tests/028
>  create mode 100644 tests/028.out
> 
> diff --git a/tests/028 b/tests/028
> new file mode 100755
> index 0000000..a9584ed
> --- /dev/null
> +++ b/tests/028
> @@ -0,0 +1,60 @@
> +#!/bin/bash
> +
> +# Test sheep recovery logic
> +
> +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 `seq 0 1`; do _start_sheep $i; done
> +
> +_wait_for_sheep 2
> +
> +$COLLIE cluster format -c 2
> +
> +$COLLIE vdi create test 20M
> +
> +dd if=/dev/urandom | $COLLIE vdi write test
> +$COLLIE vdi read test | md5sum > /tmp/csum.0
> +
> +for i in 2 3; do
> +    _start_sheep $i
> +    sleep 1
> +    _kill_sheep $(($i-2))
> +    _wait_for_sheep_recovery $i
> +done
> +
> +dd if=/dev/urandom | $COLLIE vdi write test -p 7002
> +$COLLIE vdi read test -p 7002 | md5sum > /tmp/csum.1
> +
> +for i in 2 3; do
> +    _start_sheep $(($i-2))
> +    sleep 1
> +    _kill_sheep $i
> +    _wait_for_sheep_recovery $(($i-2))
> +done
> +
> +$COLLIE vdi read test | md5sum > /tmp/csum.2
> +$COLLIE vdi read test -p 7001 | md5sum > /tmp/csum.3
> +
> +$COLLIE vdi object test
> +
> +for i in `seq 0 1`; do
> +    $COLLIE vdi object -i $i test
> +done
> +
> +if [ "$diff -u /tmp/csum.0 /tmp/csum.1)" ]; then
> +    echo "update test successfully"
> +fi
> +
> +diff -u /tmp/csum.1 /tmp/csum.2
> +diff -u /tmp/csum.1 /tmp/csum.3
> diff --git a/tests/028.out b/tests/028.out
> new file mode 100644
> index 0000000..c1278ba
> --- /dev/null
> +++ b/tests/028.out
> @@ -0,0 +1,15 @@
> +QA output created by 028
> +using backend farm store
> +Looking for the inode object 0x7c2b25 with 2 nodes
> +
> +127.0.0.1:7000 has the object (should be 2 copies)
> +127.0.0.1:7001 has the object (should be 2 copies)
> +Looking for the object 0x7c2b2500000000 (the inode vid 0x7c2b25 idx 0) with 2 nodes
> +
> +127.0.0.1:7000 has the object (should be 2 copies)
> +127.0.0.1:7001 has the object (should be 2 copies)
> +Looking for the object 0x7c2b2500000001 (the inode vid 0x7c2b25 idx 1) with 2 nodes
> +
> +127.0.0.1:7000 has the object (should be 2 copies)
> +127.0.0.1:7001 has the object (should be 2 copies)
> +update test successfully
> diff --git a/tests/group b/tests/group
> index 57edea5..28710b5 100644
> --- a/tests/group
> +++ b/tests/group
> @@ -39,3 +39,4 @@
>  025 auto quick cluster
>  026 auto quick vdi
>  027 auto quick store
> +028 auto quick store
> 

Applied.

Thanks,
Yuan



More information about the sheepdog mailing list