[sheepdog] [PATCH v4 1/2] tests/functional: add a new test for lost and corrupted objects
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Nov 12 03:40:05 CET 2013
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
tests/functional/077 | 85 ++++++++++++++++++++++++++++++++++++++++++++++
tests/functional/077.out | 16 +++++++++
tests/functional/078 | 53 +++++++++++++++++++++++++++++
tests/functional/group | 1 +
4 files changed, 155 insertions(+)
create mode 100644 tests/functional/077
create mode 100644 tests/functional/077.out
create mode 100644 tests/functional/078
diff --git a/tests/functional/077 b/tests/functional/077
new file mode 100644
index 0000000..71db820
--- /dev/null
+++ b/tests/functional/077
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Test vdi repair functionality
+
+. ./common
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 12M
+_vdi_list
+
+echo "original data" | $DOG vdi write test
+
+$DOG cluster shutdown
+
+# single object lost
+
+rm $STORE/0/obj/007c2b2500000000
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
+
+$DOG vdi read test 0 14
+
+$DOG cluster shutdown
+
+# single broken object
+
+_random | dd of=$STORE/1/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
+
+$DOG vdi read test 0 14
+
+$DOG cluster shutdown
+
+# two object lost
+
+rm $STORE/0/obj/007c2b2500000000
+rm $STORE/1/obj/007c2b2500000000
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
+
+$DOG vdi read test 0 14
+
+$DOG cluster shutdown
+
+# single object lost, single broken object. no majority
+
+rm $STORE/0/obj/007c2b2500000000
+_random | dd of=$STORE/1/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
+
+$DOG cluster shutdown
+
diff --git a/tests/functional/077.out b/tests/functional/077.out
new file mode 100644
index 0000000..5bddb9b
--- /dev/null
+++ b/tests/functional/077.out
@@ -0,0 +1,16 @@
+QA output created by 077
+using backend plain store
+ Name Id Size Used Shared Creation time VDI id Copies Tag
+ test 0 12 MB 0.0 MB 0.0 MB DATE 7c2b25 3
+fixed missing 7c2b2500000000
+finish check&repair test
+original data
+fixed replica 7c2b2500000000
+finish check&repair test
+original data
+fixed missing 7c2b2500000000
+fixed missing 7c2b2500000000
+finish check&repair test
+original data
+no majority of 7c2b2500000000
+finish check&repair test
diff --git a/tests/functional/078 b/tests/functional/078
new file mode 100644
index 0000000..743bbf2
--- /dev/null
+++ b/tests/functional/078
@@ -0,0 +1,53 @@
+# every object lost. no majority
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 12M
+
+echo "original data" | $DOG vdi write test
+
+rm $STORE/0/obj/007c2b2500000000
+rm $STORE/1/obj/007c2b2500000000
+rm $STORE/2/obj/007c2b2500000000
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
+
+$DOG cluster shutdown
+
+# no original object. no majority
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 12M
+
+echo "original data" | $DOG vdi write test
+
+dd if=/dev/urandom of=$STORE/0/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null
+dd if=/dev/urandom of=$STORE/1/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null
+dd if=/dev/urandom of=$STORE/2/obj/007c2b2500000000 bs=4096 count=1024 &> /dev/null
+
+for i in `seq 0 2`; do
+ _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+$DOG vdi check test
diff --git a/tests/functional/group b/tests/functional/group
index 8d15ffe..22ec578 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -91,3 +91,4 @@
074 auto quick clster md
075 auto quick vdi md
076 auto quick vdi md
+077 auto quick vdi
--
1.7.10.4
More information about the sheepdog
mailing list