[sheepdog] [PATCH v2] Add test case to test data integrity after changing my address of sheep process

Liu Yuan namei.unix at gmail.com
Thu Mar 6 10:27:50 CET 2014


On Thu, Mar 06, 2014 at 04:58:05PM +0800, Ruoyu wrote:
> If modifying the "my address" of sheep parameter without intention,
> the cluster treates it as a new node so that we know the operation is wrong.
> However, when trying to revert, we find out the prior created vdi is lost.
> 
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  tests/functional/088           | 49 ++++++++++++++++++++++++++++++++++++++++++
>  tests/functional/088.out       | 41 +++++++++++++++++++++++++++++++++++
>  tests/functional/common.filter |  5 +++++
>  tests/functional/group         |  1 +
>  4 files changed, 96 insertions(+)
>  create mode 100755 tests/functional/088
>  create mode 100644 tests/functional/088.out
> 
> diff --git a/tests/functional/088 b/tests/functional/088
> new file mode 100755
> index 0000000..012d768
> --- /dev/null
> +++ b/tests/functional/088
> @@ -0,0 +1,49 @@
> +#!/bin/bash
> +
> +# Test data integrity after changing my address (sheep -y <myaddr>)
> +
> +. ./common
> +
> +MY_ADDR=`hostname -I | awk '{print $1}'`
> +ORIG_SHEEP_OPTIONS=$SHEEP_OPTIONS
> +NEW_SHEEP_OPTIONS="-n -y $MY_ADDR -l level=debug"
> +
> +echo "1. start sheep with my address"
> +SHEEP_OPTIONS=$NEW_SHEEP_OPTIONS
> +_start_sheep 0
> +_wait_for_sheep 1
> +echo "----- cluster format ------"
> +_cluster_format -c 1
> +echo "----- cluster info -----"
> +$DOG cluster info | _filter_cluster_info | _filter_ip
> +echo "----- vdi create -----"
> +$DOG vdi create test 40M -P
> +echo "----- vdi list -----"
> +_vdi_list
> +echo "----- cluster shutdown -----"
> +$DOG cluster shutdown
> +_wait_for_sheep_stop
> +
> +echo "2. start sheep with default"
> +SHEEP_OPTIONS=$ORIG_SHEEP_OPTIONS
> +_start_sheep 0
> +_wait_for_sheep 1
> +echo "----- cluster info -----"
> +$DOG cluster info | _filter_cluster_info | _filter_ip
> +echo "----- node info -----"
> +$DOG node info
> +echo "----- cluster shutdown -----"
> +$DOG cluster shutdown
> +_wait_for_sheep_stop
> +
> +echo "3. start sheep with my address again"
> +SHEEP_OPTIONS=$NEW_SHEEP_OPTIONS
> +_start_sheep 0
> +_wait_for_sheep 1
> +echo "----- cluster info -----"
> +$DOG cluster info | _filter_cluster_info | _filter_ip
> +echo "----- vdi list -----"
> +_vdi_list
> +echo "----- cluster shutdown -----"
> +$DOG cluster shutdown
> +_wait_for_sheep_stop
> diff --git a/tests/functional/088.out b/tests/functional/088.out
> new file mode 100644
> index 0000000..4e778bf
> --- /dev/null
> +++ b/tests/functional/088.out
> @@ -0,0 +1,41 @@
> +QA output created by 088
> +1. start sheep with my address
> +----- cluster format ------
> +using backend plain store
> +----- cluster info -----
> +Cluster status: running, auto-recovery enabled
> +
> +Cluster created at DATE
> +
> +Epoch Time           Version
> +DATE      1 [IP:7000]
> +----- vdi create -----
> +----- vdi list -----
> +  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
> +  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25      1              
> +----- cluster shutdown -----
> +2. start sheep with default
> +----- cluster info -----
> +Cluster status: Waiting for other nodes to join cluster
> +
> +Cluster created at DATE
> +
> +Epoch Time           Version
> +DATE      1 [IP:7000]
> +----- node info -----
> +Response's result: Waiting for other nodes to join cluster
> +Cannot get information from any nodes
> +Id	Size	Used	Avail	Use%
> +----- cluster shutdown -----
> +3. start sheep with my address again
> +----- cluster info -----
> +Cluster status: running, auto-recovery enabled
> +
> +Cluster created at DATE
> +
> +Epoch Time           Version
> +DATE      1 [IP:7000]
> +----- vdi list -----
> +  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
> +  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25      1              
> +----- cluster shutdown -----
> diff --git a/tests/functional/common.filter b/tests/functional/common.filter
> index 2c62ef2..83061d7 100644
> --- a/tests/functional/common.filter
> +++ b/tests/functional/common.filter
> @@ -139,6 +139,11 @@ _filter_short_date()
>      sed -e 's/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]/DATE/g'
>  }
>  
> +_filter_ip()
> +{
> +    sed -e 's/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/IP/g'
> +}
> +
>  # remove trailing whitespace, some versions of sg3_utils do that
>  _filter_spaces()
>  {
> diff --git a/tests/functional/group b/tests/functional/group
> index 0c9b71a..b073747 100644
> --- a/tests/functional/group
> +++ b/tests/functional/group
> @@ -102,3 +102,4 @@
>  085 auto quick vdi md
>  086 auto quick vdi md
>  087 auto quick vdi md
> +088 auto quick cluster
> -- 
> 1.8.1.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied thanks

Yuan



More information about the sheepdog mailing list