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

Ruoyu liangry at ucweb.com
Thu Mar 6 05:10:29 CET 2014


If modifying the "my address" of sheep process 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.

new: tests/functional/088 and 088.out: test case and expected output
modified: tests/functional/common.filter: add function of filtering ip address
modified: tests/functional/group: test case name and define

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 tests/functional/088           | 50 ++++++++++++++++++++++++++++++++++++++++++
 tests/functional/088.out       | 41 ++++++++++++++++++++++++++++++++++
 tests/functional/common.filter |  5 +++++
 tests/functional/group         |  1 +
 4 files changed, 97 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..f7dda79
--- /dev/null
+++ b/tests/functional/088
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Test data integrity after changing my address (sheep -y <myaddr>)
+
+. ./common
+
+# Is there an easier and more robust way to do this?
+MY_ADDR=`netstat -n -t | awk '{print $4}' | grep -o "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | grep -v "127.0.0.1" | sort -u | head -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





More information about the sheepdog mailing list