[sheepdog] [PATCH 4/4 v3] test/functional: add test cases for tree store_driver

Saeki Masaki saeki.masaki at po.ntts.co.jp
Fri Mar 20 10:39:11 CET 2015


functional test for new store driver named "tree"

v2: fix output, remaining inode file counts has changed.

Signed-off-by: Masaki Saeki <saeki.masaki at po.ntts.co.jp>
---
  tests/functional/101     |   41 ++++++++++++++++++++++++++++++++
  tests/functional/101.out |   30 +++++++++++++++++++++++
  tests/functional/102     |   58 ++++++++++++++++++++++++++++++++++++++++++++++
  tests/functional/102.out |   52 +++++++++++++++++++++++++++++++++++++++++
  tests/functional/103     |   52 +++++++++++++++++++++++++++++++++++++++++
  tests/functional/103.out |   53 ++++++++++++++++++++++++++++++++++++++++++
  tests/functional/104     |   44 ++++++++++++++++++++++++++++++++++
  tests/functional/104.out |   45 +++++++++++++++++++++++++++++++++++
  tests/functional/group   |    4 +++
  9 files changed, 379 insertions(+), 0 deletions(-)
  create mode 100755 tests/functional/101
  create mode 100644 tests/functional/101.out
  create mode 100755 tests/functional/102
  create mode 100644 tests/functional/102.out
  create mode 100755 tests/functional/103
  create mode 100644 tests/functional/103.out
  create mode 100755 tests/functional/104
  create mode 100644 tests/functional/104.out

diff --git a/tests/functional/101 b/tests/functional/101
new file mode 100755
index 0000000..97e5f9d
--- /dev/null
+++ b/tests/functional/101
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Test format option for store_driver(tree)
+
+. ./common
+
+for i in 0 1 2 3; do
+    _start_sheep $i
+done
+_wait_for_sheep 4
+
+# cluster format with replica mode
+$DOG cluster format -c 3 -b tree
+
+$DOG vdi create test 16M
+$DOG vdi snapshot test
+
+$DOG vdi list | _filter_short_date
+
+$DOG vdi delete test -s 1
+$DOG vdi delete test
+
+$DOG vdi list | _filter_short_date
+
+# format with erasure code
+echo "yes" | $DOG cluster format -c 2:1 -b tree
+$DOG vdi create test 16M -P
+$DOG vdi list | _filter_short_date
+$DOG vdi delete test
+$DOG vdi list | _filter_short_date
+
+# format with long option
+echo "yes" | $DOG cluster format --copies 3 --store tree
+$DOG vdi create test 16M -P
+$DOG vdi list | _filter_short_date
+$DOG vdi delete test
+
+# invalid store name
+echo "yes" | $DOG cluster format -c 3 -b dummy | _filter_spaces
+
+status=0
diff --git a/tests/functional/101.out b/tests/functional/101.out
new file mode 100644
index 0000000..bef4b4c
--- /dev/null
+++ b/tests/functional/101.out
@@ -0,0 +1,30 @@
+QA output created by 101
+using backend tree store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         1   16 MB  0.0 MB  0.0 MB DATE   7c2b25      3                22
+  test         0   16 MB  0.0 MB  0.0 MB DATE   7c2b26      3                22
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+    __
+   ()'`;
+   /\|`
+  /  |   Caution! The cluster is not empty.
+(/_)_|_  Are you sure you want to continue? [yes/no]: using backend tree store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+  test         0   16 MB   16 MB  0.0 MB DATE   7c2b25    2:1                22
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+    __
+   ()'`;
+   /\|`
+  /  |   Caution! The cluster is not empty.
+(/_)_|_  Are you sure you want to continue? [yes/no]: using backend tree store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+  test         0   16 MB   16 MB  0.0 MB DATE   7c2b25      3                22
+Format failed: Targeted backend store is not found
+    __
+   ()'`;
+   /\|`
+  /  |   Caution! The cluster is not empty.
+(/_)_|_  Are you sure you want to continue? [yes/no]: using backend dummy store
+Available stores:
+---------------------------------------
+plain tree
diff --git a/tests/functional/102 b/tests/functional/102
new file mode 100755
index 0000000..f5e041b
--- /dev/null
+++ b/tests/functional/102
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Test object creation for store_driver(tree)
+
+. ./common
+
+for i in 0 1 2 3 4 5; do
+    _start_sheep $i
+done
+_wait_for_sheep 6
+_cluster_format -c 3 -b tree
+
+echo "CHECK data/ledger object"
+
+echo "create inode/data/ledger objects"
+$DOG vdi create test 16M
+_random | $DOG vdi write test 0 512
+$DOG vdi snapshot test
+_random | $DOG vdi write test 0 512
+$DOG vdi clone -s 1 test test2
+_random | $DOG vdi write test2 0 512
+$DOG vdi delete test
+$DOG vdi list | _filter_short_date
+
+_node_info
+
+echo "after delete whole vdis"
+$DOG vdi delete test -s 1
+$DOG vdi delete test2
+
+_node_info
+
+echo "yes" | $DOG cluster format -b tree
+
+echo "CHECK erasure object"
+echo "create inode/data erasure code objects"
+
+$DOG vdi create -c 4:2 test 16M
+_random | $DOG vdi write test 0 512
+$DOG vdi list | _filter_short_date
+
+_node_info
+
+$DOG vdi delete test
+
+echo "yes" | $DOG cluster format -b tree
+
+echo "CHECK attr object"
+echo -n value > $STORE/tmp.dat
+
+$DOG vdi create test 16M
+$DOG vdi setattr test key value
+$DOG vdi getattr test key | diff - $STORE/tmp.dat
+
+echo "create attr objects"
+_node_info
+
+$DOG vdi delete test
diff --git a/tests/functional/102.out b/tests/functional/102.out
new file mode 100644
index 0000000..b8dc7d4
--- /dev/null
+++ b/tests/functional/102.out
@@ -0,0 +1,52 @@
+QA output created by 102
+using backend tree store
+CHECK data/ledger object
+create inode/data/ledger objects
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         1   16 MB  4.0 MB  0.0 MB DATE   7c2b25      3                22
+c test2        0   16 MB  4.0 MB  0.0 MB DATE   fd3815      3                22
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	1	2	0	0	1	0
+1	1	3	0	0	0	0
+2	1	3	0	0	0	0
+3	2	0	0	0	0	0
+4	1	1	0	0	1	0
+5	0	0	0	0	1	0
+after delete whole vdis
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	0	2	0	0	0	0
+1	0	3	0	0	0	0
+2	0	3	0	0	0	0
+3	0	0	0	0	0	0
+4	0	1	0	0	0	0
+5	0	0	0	0	0	0
+    __
+   ()'`;
+   /\|`
+  /  |   Caution! The cluster is not empty.
+(/_)_|_  Are you sure you want to continue? [yes/no]: using backend tree store
+CHECK erasure object
+create inode/data erasure code objects
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+  test         0   16 MB  4.0 MB  0.0 MB DATE   7c2b25    4:2                22
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	1	1	0	0	0	0
+1	1	1	0	0	0	0
+2	1	1	0	0	0	0
+3	1	1	0	0	0	0
+4	1	1	0	0	0	0
+5	1	1	0	0	0	0
+    __
+   ()'`;
+   /\|`
+  /  |   Caution! The cluster is not empty.
+(/_)_|_  Are you sure you want to continue? [yes/no]: using backend tree store
+CHECK attr object
+create attr objects
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	0	0	0	1	0	0
+1	0	1	0	1	0	0
+2	0	1	0	0	0	0
+3	0	0	0	0	0	0
+4	0	1	0	0	0	0
+5	0	0	0	1	0	0
diff --git a/tests/functional/103 b/tests/functional/103
new file mode 100755
index 0000000..43d1a60
--- /dev/null
+++ b/tests/functional/103
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# Test auto recovery for store_driver(tree)
+
+. ./common
+
+for i in 0 1 2 3 ; do
+    _start_sheep $i
+done
+_wait_for_sheep 4
+_cluster_format -c 3 -b tree
+
+$DOG vdi create test 40M
+
+for i in `seq 0 4`; do
+    echo $i | $DOG vdi write test $((i * 4 * 1024 * 1024)) 512
+done
+
+$DOG vdi list | _filter_short_date
+$DOG node list
+_node_info
+
+echo "check remove node"
+_kill_sheep 3
+_wait_for_sheep_stop 3
+sleep 5
+
+echo "node=3 down"
+$DOG node list
+_node_info
+
+echo "write data while node stopped"
+for i in `seq 5 9`; do
+    echo $i | $DOG vdi write test $((i * 4 * 1024 * 1024)) 512
+done
+echo "create vdi while node stopped"
+$DOG vdi snapshot test
+$DOG vdi clone -s 1 test test2
+$DOG vdi create test3 40M -P
+
+$DOG vdi list | _filter_short_date
+$DOG node list
+_node_info
+
+echo "check recovery node"
+_start_sheep 3
+_wait_for_sheep 4
+
+echo "node=3 up"
+$DOG node list
+_node_info
+
diff --git a/tests/functional/103.out b/tests/functional/103.out
new file mode 100644
index 0000000..f75e037
--- /dev/null
+++ b/tests/functional/103.out
@@ -0,0 +1,53 @@
+QA output created by 103
+using backend tree store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+  test         0   40 MB   20 MB  0.0 MB DATE   7c2b25      3                22
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+   3   127.0.0.1:7003      	128          3
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	4	0	0	0	0	0
+1	4	1	0	0	0	0
+2	3	1	0	0	0	0
+3	4	1	0	0	0	0
+check remove node
+node=3 down
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	5	1	0	0	0	0
+1	5	1	0	0	0	0
+2	5	1	0	0	0	0
+3	4	1	0	0	0	0
+write data while node stopped
+create vdi while node stopped
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         1   40 MB   40 MB  0.0 MB DATE   7c2b25      3                22
+  test         0   40 MB  0.0 MB   40 MB DATE   7c2b26      3                22
+  test3        0   40 MB   40 MB  0.0 MB DATE   fd3662      3                22
+c test2        0   40 MB  0.0 MB   40 MB DATE   fd3815      3                22
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	20	4	0	0	0	0
+1	20	4	0	0	0	0
+2	20	4	0	0	0	0
+3	4	1	0	0	0	0
+check recovery node
+node=3 up
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+   3   127.0.0.1:7003      	128          3
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	14	3	0	0	0	0
+1	17	4	0	0	0	0
+2	16	3	0	0	0	0
+3	13	2	0	0	0	0
diff --git a/tests/functional/104 b/tests/functional/104
new file mode 100755
index 0000000..b38e23b
--- /dev/null
+++ b/tests/functional/104
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Test restart cluster for store_driver(tree)
+
+. ./common
+
+for i in 0 1 2 3 ; do
+    _start_sheep $i
+done
+_wait_for_sheep 4
+_cluster_format -c 3 -b tree
+
+$DOG vdi create test 16M
+_random | $DOG vdi write test 0 512
+$DOG vdi snapshot test
+_random | $DOG vdi write test 0 512
+$DOG vdi clone -s 1 test test2
+_random | $DOG vdi write test2 0 512
+$DOG vdi delete test
+
+echo "check vdi/cluster status"
+$DOG vdi list | _filter_short_date
+$DOG node list
+$DOG cluster info | _filter_cluster_info | _filter_ip
+_node_info
+
+# restart sheepdog
+echo "restart sheepdog cluster"
+$DOG cluster shutdown
+for i in 0 1 2 3 ; do
+    _start_sheep $i
+done
+_wait_for_sheep 4
+
+echo "operation should be fail"
+$DOG vdi clone -s 1 test test2
+
+echo "check vdi/cluster status again"
+$DOG vdi list | _filter_short_date
+$DOG node list
+$DOG cluster info | _filter_cluster_info | _filter_ip
+_node_info
+
+status=0
diff --git a/tests/functional/104.out b/tests/functional/104.out
new file mode 100644
index 0000000..8c240db
--- /dev/null
+++ b/tests/functional/104.out
@@ -0,0 +1,45 @@
+QA output created by 104
+using backend tree store
+check vdi/cluster status
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         1   16 MB  4.0 MB  0.0 MB DATE   7c2b25      3                22
+c test2        0   16 MB  4.0 MB  0.0 MB DATE   fd3815      3                22
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+   3   127.0.0.1:7003      	128          3
+Cluster status: running, auto-recovery enabled
+
+Cluster created at DATE
+
+Epoch Time           Version [Host:Port:V-Nodes,,,]
+DATE      1 [IP:7000:128, IP:7001:128, IP:7002:128, IP:7003:128]
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	1	2	0	0	1	0
+1	2	3	0	0	1	0
+2	1	3	0	0	1	0
+3	2	1	0	0	0	0
+restart sheepdog cluster
+operation should be fail
+Failed to create VDI test2: VDI exists already
+check vdi/cluster status again
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag   Block Size Shift
+s test         1   16 MB  4.0 MB  0.0 MB DATE   7c2b25      3                22
+c test2        0   16 MB  4.0 MB  0.0 MB DATE   fd3815      3                22
+  Id   Host:Port         V-Nodes       Zone
+   0   127.0.0.1:7000      	128          0
+   1   127.0.0.1:7001      	128          1
+   2   127.0.0.1:7002      	128          2
+   3   127.0.0.1:7003      	128          3
+Cluster status: running, auto-recovery enabled
+
+Cluster created at DATE
+
+Epoch Time           Version [Host:Port:V-Nodes,,,]
+DATE      1 [IP:7000:128, IP:7001:128, IP:7002:128, IP:7003:128]
+STORE	DATA	VDI	VMSTATE	ATTR	LEDGER	STALE
+0	1	2	0	0	1	0
+1	2	3	0	0	1	0
+2	1	3	0	0	1	0
+3	2	1	0	0	0	0
diff --git a/tests/functional/group b/tests/functional/group
index 2e03738..ee2b1f2 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -115,3 +115,7 @@
  098 auto quick vdi cluster
  099 auto quick vdi cluster
  100 auto quick vdi
+101 auto quick store vdi
+102 auto quick store vdi
+103 auto quick store vdi
+104 auto quick store vdi
-- 
1.7.1






More information about the sheepdog mailing list