[sheepdog] [PATCH 2/2] test: test some unusual collie commands

Liu Yuan namei.unix at gmail.com
Wed Nov 21 08:29:01 CET 2012


From: Liu Yuan <tailai.ly at taobao.com>

Currently 048 test 'collie track | check | list -r | kill'

048 is dedicated to the collie comands that aren't tested in the other
tests.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/048     |   54 +++++++++++++++++++++++++++++++++++++++++++
 tests/048.out |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/group   |    2 ++
 3 files changed, 128 insertions(+)
 create mode 100755 tests/048
 create mode 100644 tests/048.out

diff --git a/tests/048 b/tests/048
new file mode 100755
index 0000000..51c6fe2
--- /dev/null
+++ b/tests/048
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# Test some collie commands
+
+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
+
+$COLLIE vdi create test 1G
+
+echo hello | $COLLIE vdi write test 4M 512
+# kill the master gracefully
+$COLLIE node kill 0
+_wait_for_sheep_recovery 1
+$COLLIE node list -p 7001
+
+for i in 3 4 0; do
+	_start_sheep $i
+	sleep 1
+done
+_wait_for_sheep 5
+_wait_for_sheep_recovery 0
+
+$COLLIE vdi track test
+$COLLIE vdi track -i 1 test
+$COLLIE vdi list test | _filter_short_date
+$COLLIE vdi list -r test | awk '{$7="MASKED";print $0}'
+
+$COLLIE vdi check test
+# clear the 'first' data block
+dd if=/dev/zero of=$STORE/0/obj/007c2b2500000001 bs=1M count=4 > /dev/null 2>&1
+# 'check' is rather dumb, it just restores 'first' data object
+$COLLIE vdi check test
+# We should get nothing
+$COLLIE vdi read test 4M 512 | tr -d [:cntrl:]
+echo ''
diff --git a/tests/048.out b/tests/048.out
new file mode 100644
index 0000000..a13ace3
--- /dev/null
+++ b/tests/048.out
@@ -0,0 +1,72 @@
+QA output created by 048
+using backend farm store
+M   Id   Host:Port         V-Nodes       Zone
+-    0   127.0.0.1:7001      	64          1
+-    1   127.0.0.1:7002      	64          2
+Tracking the inode object 0x7c2b25 with 5 nodes
+
+obj 807c2b2500000000 locations at epoch 1, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7000
+127.0.0.1:7002
+
+obj 807c2b2500000000 locations at epoch 2, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7002
+
+obj 807c2b2500000000 locations at epoch 3, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7002
+127.0.0.1:7003
+
+obj 807c2b2500000000 locations at epoch 4, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7002
+127.0.0.1:7003
+
+obj 807c2b2500000000 locations at epoch 5, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7000
+127.0.0.1:7002
+Tracking the object 0x7c2b2500000001 (the inode vid 0x7c2b25 idx 1) with 5 nodes
+
+obj 7c2b2500000001 locations at epoch 1, copies = 3
+---------------------------------------------------
+127.0.0.1:7000
+127.0.0.1:7001
+127.0.0.1:7002
+
+obj 7c2b2500000001 locations at epoch 2, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7002
+
+obj 7c2b2500000001 locations at epoch 3, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7003
+127.0.0.1:7002
+
+obj 7c2b2500000001 locations at epoch 4, copies = 3
+---------------------------------------------------
+127.0.0.1:7001
+127.0.0.1:7004
+127.0.0.1:7003
+
+obj 7c2b2500000001 locations at epoch 5, copies = 3
+---------------------------------------------------
+127.0.0.1:7000
+127.0.0.1:7001
+127.0.0.1:7004
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         1  1.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3              
+= test 1 1073741824 4194304 0 MASKED 7c2b25 3
+finish check&repair test
+fix 7c2b2500000001 success
+finish check&repair test
+
diff --git a/tests/group b/tests/group
index aaddfeb..70389bf 100644
--- a/tests/group
+++ b/tests/group
@@ -11,6 +11,7 @@
 # cluster:	cluster drivers tests: join/leave/etc
 # store:	basic data integrity
 # vdi:		qemu I/O, snapshots, volume creation and deletion
+# collie:	check collie commands
 #
 001 auto quick cluster
 002 auto quick cluster
@@ -59,3 +60,4 @@
 045 auto quick store
 046 auto quick vdi
 047 auto quick vdi
+048 auto quick collie
-- 
1.7.9.5




More information about the sheepdog mailing list