[sheepdog] [PATCH] add test scripts
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Aug 9 11:55:35 CEST 2012
This also removes old tests which are no longer used.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
Makefile.am | 2 +-
configure.ac | 4 +-
tests/Makefile.am | 40 ----------
tests/cluster/001.sh | 54 +++++++++++++
tests/cluster/002.sh | 47 +++++++++++
tests/cluster/003.sh | 47 +++++++++++
tests/cluster/004.sh | 55 +++++++++++++
tests/cluster/005.sh | 53 +++++++++++++
tests/cluster/006.sh | 32 ++++++++
tests/cluster/007.sh | 43 ++++++++++
tests/qemu_io_testcases.py | 182 --------------------------------------------
tests/sheepdog_test.py | 159 --------------------------------------
tests/store/001.sh | 62 +++++++++++++++
tests/store/002.sh | 41 ++++++++++
tests/store/003.sh | 32 ++++++++
tests/store/004.sh | 31 ++++++++
tests/store/005.sh | 25 ++++++
tests/test_membership.py | 70 -----------------
tests/test_qemu_io.py | 83 --------------------
tests/test_vdi.py | 26 ------
tests/vdi/001.sh | 32 ++++++++
tests/vdi/002.sh | 35 +++++++++
tests/vdi/003.sh | 56 ++++++++++++++
tests/vdi/004.sh | 45 +++++++++++
tests/vdi/005.sh | 40 ++++++++++
25 files changed, 732 insertions(+), 564 deletions(-)
delete mode 100644 tests/Makefile.am
create mode 100755 tests/cluster/001.sh
create mode 100755 tests/cluster/002.sh
create mode 100755 tests/cluster/003.sh
create mode 100755 tests/cluster/004.sh
create mode 100755 tests/cluster/005.sh
create mode 100755 tests/cluster/006.sh
create mode 100755 tests/cluster/007.sh
delete mode 100644 tests/qemu_io_testcases.py
delete mode 100644 tests/sheepdog_test.py
create mode 100755 tests/store/001.sh
create mode 100755 tests/store/002.sh
create mode 100755 tests/store/003.sh
create mode 100755 tests/store/004.sh
create mode 100755 tests/store/005.sh
delete mode 100644 tests/test_membership.py
delete mode 100644 tests/test_qemu_io.py
delete mode 100644 tests/test_vdi.py
create mode 100755 tests/vdi/001.sh
create mode 100755 tests/vdi/002.sh
create mode 100755 tests/vdi/003.sh
create mode 100755 tests/vdi/004.sh
create mode 100755 tests/vdi/005.sh
diff --git a/Makefile.am b/Makefile.am
index d0715d0..f1b97eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@ sheepdogsysconfdir = ${SHEEPDOGCONFDIR}
sheepdogsysconf_DATA =
-SUBDIRS = lib collie sheep include script man tests
+SUBDIRS = lib collie sheep include script man
if BUILD_SHEEPFS
SUBDIRS += sheepfs
diff --git a/configure.ac b/configure.ac
index 18e4685..91126e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,6 @@ AM_INIT_AUTOMAKE([-Wno-portability])
AC_CONFIG_SRCDIR([collie/collie.c])
AC_CONFIG_HEADER([include/config.h])
-AC_CONFIG_TESTDIR([tests])
AC_CANONICAL_HOST
@@ -134,8 +133,7 @@ AC_CONFIG_FILES([Makefile
include/Makefile
script/Makefile
lib/Makefile
- man/Makefile
- tests/Makefile])
+ man/Makefile])
### Local business
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 3dafe9f..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-$(srcdir)/package.m4: $(top_srcdir)/configure.ac
- @{ \
- echo '# Signature of the current package.'; \
- echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
- echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
- echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
- echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
- echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
- echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
- } > '$(srcdir)/package.m4'
-
-EXTRA_DIST =
-TESTSUITE = $(srcdir)/testsuite
-AUTOTEST = $(AUTOM4TE) --language=autotest
-
-check-local: atconfig $(srcdir)/package.m4
- @{ \
- echo 'AT_INIT()'; \
- echo 'AT_COLOR_TESTS'; \
- for f in *.py; do \
- f=$${f%.py}; \
- echo "AT_BANNER([$$f])"; \
- python -c "import $$f; import sys; \
- [sys.stdout.write( \
- 'AT_SETUP([' + f + '])\n' + \
- 'AT_CHECK([ \
- PYTHONPATH=$(abs_srcdir) \
- SHEEP=$(abs_top_builddir)/sheep/sheep \
- COLLIE=$(abs_top_builddir)/collie/collie \
- python -c \'import $$f; $$f.' + f + '()\' \
- ],,stdout,stderr)\n' + \
- 'AT_CLEANUP()\n' \
- ) for f in dir($$f) if f.startswith('test_')]"; \
- done \
- } > '$(TESTSUITE).at'
- $(AUTOTEST) -I '$(srcdir)' -o '$(TESTSUITE)' '$(TESTSUITE).at'
- $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
-
-clean-local:
- test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean
diff --git a/tests/cluster/001.sh b/tests/cluster/001.sh
new file mode 100755
index 0000000..9df1b90
--- /dev/null
+++ b/tests/cluster/001.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# start Sheepdog with two nodes
+$COLLIE cluster format
+
+# kill the master node
+pkill -f "sheep $STORE/0"
+sleep 1
+
+# start another sheep
+$SHEEP $STORE/2 -z 2 -p 7002 -c $DRIVER
+sleep 1
+
+# kill all sheeps
+for i in 1 2; do
+ pkill -f "sheep $STORE/$i"
+ sleep 1
+done
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether Sheepdog is running with only one node
+$COLLIE cluster info -p 7002
+
+# add the other nodes
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether all nodes have the same cluster info
+for i in 0 1 2; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/002.sh b/tests/cluster/002.sh
new file mode 100755
index 0000000..4b827a0
--- /dev/null
+++ b/tests/cluster/002.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# start Sheepdog with three nodes
+$COLLIE cluster format
+
+# kill all sheeps
+for i in 0 1 2; do
+ pkill -f "sheep $STORE/$i"
+ sleep 1
+done
+
+# master transfer will happen once
+for i in 1 0 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether Sheepdog is running with only one node
+$COLLIE cluster info -p 7002
+
+# add the other nodes
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether all nodes have the same cluster info
+for i in 0 1 2; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/003.sh b/tests/cluster/003.sh
new file mode 100755
index 0000000..e0ea8c9
--- /dev/null
+++ b/tests/cluster/003.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# start Sheepdog with three nodes
+$COLLIE cluster format
+
+# kill all sheeps
+for i in 0 1 2; do
+ pkill -f "sheep $STORE/$i"
+ sleep 1
+done
+
+# master transfer will happen twice
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether Sheepdog is running with only one node
+$COLLIE cluster info -p 7002
+
+# add the other nodes
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether all nodes have the same cluster info
+for i in 0 1 2; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/004.sh b/tests/cluster/004.sh
new file mode 100755
index 0000000..5f7f57a
--- /dev/null
+++ b/tests/cluster/004.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# start Sheepdog with two nodes
+$COLLIE cluster format -c 2
+
+for i in 2 3 4; do
+ # add one node after killing existing one node
+ pkill -f "sheep $STORE/$((i - 2))"
+ sleep 1
+
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# kill all existing nodes
+for i in 3 4; do
+ pkill -f "sheep $STORE/$i"
+ sleep 1
+done
+
+for i in 0 1 2 3 4; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether Sheepdog is running with only one node
+$COLLIE cluster info -p 7004
+
+# add the other nodes
+for i in 0 1 2 3; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether all nodes have the same cluster info
+for i in 0 1 2 3 4; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/005.sh b/tests/cluster/005.sh
new file mode 100755
index 0000000..380763a
--- /dev/null
+++ b/tests/cluster/005.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+# start Sheepdog with two nodes
+$COLLIE cluster format -c 1
+sleep 1
+
+for i in 2 3 4; do
+ pkill -f "sheep $STORE/$((i - 2))"
+ sleep 1
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+$COLLIE cluster shutdown -p 7004
+sleep 1
+
+for i in 0 1 2 3 4; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether Sheepdog is working with two nodes
+for i in 3 4; do
+ $COLLIE cluster info -p 700$i
+done
+
+# add the other nodes
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+ sleep 1
+done
+
+echo check whether all nodes have the same cluster info
+for i in 0 1 2 3 4; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/006.sh b/tests/cluster/006.sh
new file mode 100755
index 0000000..bca477d
--- /dev/null
+++ b/tests/cluster/006.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+$SHEEP $STORE/0 -z 0 -p 7000 -c $DRIVER
+sleep 1
+
+# start Sheepdog with one node
+$COLLIE cluster format
+sleep 1
+
+# launch sheeps simultaneously
+for i in `seq 1 9`; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+
+sleep 1
+
+echo check whether all nodes have the same cluster info
+for i in `seq 0 9`; do
+ $COLLIE cluster info -p 700$i
+done
diff --git a/tests/cluster/007.sh b/tests/cluster/007.sh
new file mode 100755
index 0000000..4f4657a
--- /dev/null
+++ b/tests/cluster/007.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+# create a node who has wrong epoch
+$SHEEP $STORE/1 -p 7001 -z 1 -c $DRIVER
+sleep 1
+$COLLIE cluster format -p 7001 -c 1
+$COLLIE cluster shutdown -p 7001
+sleep 1
+
+# start Sheepdog with one node
+$SHEEP $STORE/0 -p 7000 -z 0 -c $DRIVER
+sleep 1
+$COLLIE cluster format -p 7000 -c 1
+
+for i in `seq 0 5`; do
+ $SHEEP $STORE/1 -p 7001 -z 1 -c $DRIVER # should fail
+ $SHEEP $STORE/2 -p 7002 -z 2 -c $DRIVER # should succeed
+ sleep 1
+
+ if [ "`$COLLIE node list -p 7002 -r | wc -l`" -ne 2 ]; then
+ echo "test failed"
+ $COLLIE cluster info -p 7000
+ $COLLIE cluster info -p 7002
+ exit 1
+ fi
+
+ pkill -f "$SHEEP $STORE/2"
+ sleep 1
+done
+
+echo "success"
diff --git a/tests/qemu_io_testcases.py b/tests/qemu_io_testcases.py
deleted file mode 100644
index d9e8fc2..0000000
--- a/tests/qemu_io_testcases.py
+++ /dev/null
@@ -1,182 +0,0 @@
-# Copyright (c) 2011 Taobao.com, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Based on code from the QEMU I/O test suite (qemu-iotests)
-# Copyright (C) 2009 Red Hat, Inc.
-#
-
-# Brief description of each test cases.
-cases_desc = {
-"001": "Test simple read/write using plain bdrv_read/bdrv_write.",
-"002": "Test simple read/write using plain bdrv_pread/bdrv_pwrite.",
-"003": "Test simple read/write using bdrv_aio_readv/bdrv_aio_writev.",
-"004": "Make sure we can't read and write outside of the image size.",
-"008": "Test simple asynchronous read/write operations.",
-"011": "Test for AIO allocation on the same cluster.",
-"016": "Test I/O after EOF for growable images.",
-"025": "Resizing images.",
-}
-
-# Used by test_io() method.
-io_cases = {
-"001":[
-("read 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write -P 0xa 0 128M", """wrote 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -P 0xa 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-"002":[
-("read -p 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write -pP 0xa 0 128M", """wrote 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -pP 0xa 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write -pP 0xab 66 42", """wrote 42/42 bytes at offset 66
-42.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -pP 0xab 66 42", """read 42/42 bytes at offset 66
-42.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-"003":[
-("readv 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("writev -P 0xa 0 128M", """wrote 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("readv -P 0xa 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("writev -P 0xb 67M 8k 8k 8k 8k 8k 8k 8k",
-"""wrote 57344/57344 bytes at offset 70254592
-56 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("readv -P 0xb 67M 8k 8k 8k 8k 8k 8k 8k",
-"""read 57344/57344 bytes at offset 70254592
-56 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-"004":[
-("write 127M 1M", """wrote 1048576/1048576 bytes at offset 133169152
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write 127M 4M", """write failed: Input/output error"""),
-("write 128M 4096", """write failed: Input/output error"""),
-("write 140M 4096", """write failed: Input/output error"""),
-("write -p 140M 4096", """write failed: Input/output error"""),
-("writev 140M 4096","""writev failed: Input/output error"""),
-("read 127M 1M", """read 1048576/1048576 bytes at offset 133169152
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read 127M 4M", """read failed: Input/output error"""),
-("read 128M 4096", """read failed: Input/output error"""),
-("read 140M 4096", """read failed: Input/output error"""),
-("read -p 140M 4096", """read failed: Input/output error"""),
-("readv 140M 4096", """readv failed: Input/output error"""),
-],
-"008":[
-("aio_read 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("aio_write -P 0xa 0 128M", """wrote 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("aio_read -P 0xa 0 128M", """read 134217728/134217728 bytes at offset 0
-128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-"025":[
-("length", """128 MiB"""),
-("truncate 384M", """"""),
-("length", """384 MiB"""),
-],
-}
-
-# Used by test_growable_io() method.
-io_cases_g = {
-"016":[
-("read -P 0 128M 512", """read 512/512 bytes at offset 134217728
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -P 0 256M 512", """read 512/512 bytes at offset 268435456
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write -P 66 128M 512", """wrote 512/512 bytes at offset 134217728
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -P 66 128M 512", """read 512/512 bytes at offset 134217728
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("write -P 66 256M 512", """wrote 512/512 bytes at offset 268435456
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("read -P 66 256M 512", """read 512/512 bytes at offset 268435456
-512.000000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-}
-
-# Used by test_aio()
-aio_cases = {
-"011":[
-("""aio_write 1M 1M
-aio_write 1536K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 2M 1M
-aio_write 2560K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 3M 1M
-aio_write 3584K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 4M 1M
-aio_write 4608K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 5M 1M
-aio_write 5632K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 6M 1M
-aio_write 6656K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 7M 1M
-aio_write 7680K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 8M 1M
-aio_write 8704K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 9M 1M
-aio_write 9728K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-("""aio_write 10M 1M
-aio_write 10752K 1M""", """wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 1048576/1048576 bytes at offset XXX
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)"""),
-],
-}
-
-# Used to specify the image size of each test case.
-size_cases = {
-"001":128*1024*1024,
-"002":128*1024*1024,
-"003":128*1024*1024,
-"004":128*1024*1024,
-"008":128*1024*1024,
-"011":6*1024*1024*1024,
-"016":128*1024*1024,
-"025":128*1024*1024,
-}
diff --git a/tests/sheepdog_test.py b/tests/sheepdog_test.py
deleted file mode 100644
index ddce3fe..0000000
--- a/tests/sheepdog_test.py
+++ /dev/null
@@ -1,159 +0,0 @@
-#
-# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-from subprocess import *
-import os
-import re
-
-sheep_path = os.environ.get('SHEEP')
-collie_path = os.environ.get('COLLIE')
-
-
-class VirtualMachine:
- def __init__(self, node, vdi):
- self.node = node
- self.vdi = vdi
-
- def read(self, offset, size):
- """Emulate read requests."""
- vdiname = 'sheepdog:localhost:' + str(self.node.get_port()) \
- + ':' + self.vdi.name
- p = Popen(['qemu-io', vdiname, 'read', str(offset), str(size)], stdout=PIPE)
- return p
-
- def write(self, offset, size):
- """Emulate write requests."""
- vdiname = 'sheepdog:localhost:' + str(self.node.get_port()) \
- + ':' + self.vdi.name
- p = Popen(['qemu-io', vdiname, 'write', str(offset), str(size)], stdout=PIPE)
- return p
-
- def test_io(self, cmd, case, async=False):
- sed_pattern = "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* " \
- + "[EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/" \
- + "X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
- aio_pattern = "s/bytes at offset [0-9]*/bytes at offset XXX/g"
-
- vdiname = 'sheepdog:localhost:' + str(self.node.get_port()) \
- + ':' + self.vdi.name
-
- p = Popen(cmd + [vdiname], stdin=PIPE, stdout=PIPE, stderr=PIPE)
- (out, err) = p.communicate(case)
-
- out = re.sub("qemu-io>[\ \n]", "", out).strip()
- p = Popen(["sed", "-e", sed_pattern], stdin=PIPE, stdout=PIPE)
- (out, _) = p.communicate(out)
-
- if async:
- p = Popen(["sed", "-e", aio_pattern], stdin=PIPE, stdout=PIPE)
- (out, _) = p.communicate(out.strip())
-
- return (out.strip(), err.strip())
-
-class VirtualDiskImage:
- def __init__(self, name, size):
- self.name = name
- self.size = size
- self.p = Popen([collie_path, 'vdi', 'create', name, str(size)], stdout=PIPE)
-
- def wait(self):
- """Wait until this vdi is created."""
- self.p.wait()
-
- def destroy(self):
- p = Popen([collie_path, 'vdi', 'delete', self.name], stdout=PIPE)
- return p
-
-
-class Node:
- seq_nr = 0
-
- def __init__(self):
- self.idx = Node.seq_nr
- Node.seq_nr = Node.seq_nr + 1
-
- self.started = False
- self.p = None
-
- def __del__(self):
- self.stop()
-
- def get_port(self):
- return 7000 + self.idx
-
- def get_zone(self):
- return 10000 + self.idx
-
- def start(self):
- """Run a sheep daemon on this node."""
- if self.p and self.p.poll() == None:
- return
-
- self.p = Popen([sheep_path, '-f', '-d', '-p', str(self.get_port()),
- str(self.idx), '-z', str(self.get_zone())],
- stdout=PIPE, stderr=PIPE)
-
- def wait(self):
- """Wait until this node joins Sheepdog."""
- if self.started:
- return
-
- while True:
- line = self.p.stderr.readline()
- if not line:
- break
- match = re.search(r'join Sheepdog cluster', line)
- if match:
- self.started = True
- self.p.stderr=None
- break
-
- def stop(self):
- """Stop the sheep daemon on this node."""
- if self.p != None:
- self.p.terminate()
- self.p = None
-
- self.started = False
-
- def create_vm(self, vdi):
- """Create a VM instance on this node."""
- if self.p is None:
- return None
-
- return VirtualMachine(self, vdi)
-
- def run_collie(self, cmd):
- """Run administration commands on this node."""
- if self.p is None:
- return None
-
- p = Popen([collie_path + ' ' + cmd + ' -p ' + str(self.get_port())],
- shell=True, stdout=PIPE)
- return p
-
-
-class Sheepdog:
- def __init__(self, nr_nodes = 3):
- """Create a virtual Shepdog cluster with 'nr_nodes' nodes."""
- self.nodes = [Node() for _ in range(nr_nodes)]
-
- def create_vdi(self, name, size):
- return VirtualDiskImage(name, size)
-
- def format(self, node = None):
- """Format Sheepdog cluster."""
- if node is None:
- node = self.nodes[0]
-
- p = Popen([collie_path + ' cluster format -p ' + str(node.get_port())],
- shell=True, stdout=PIPE)
- return p
diff --git a/tests/store/001.sh b/tests/store/001.sh
new file mode 100755
index 0000000..a6c14cb
--- /dev/null
+++ b/tests/store/001.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in `seq 0 7`; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+while true; do
+ if [ $($COLLIE node list | wc -l) -ne 9 ]; then
+ sleep 1
+ else
+ break
+ fi
+done
+
+$COLLIE cluster format -c 3
+sleep 1
+
+for i in `seq 0 4`; do
+ $COLLIE vdi create test$i 100M
+done
+
+for i in `seq 0 4`; do
+ dd if=/dev/urandom | $COLLIE vdi write test$i -p 7000 &
+done
+
+sleep 3
+
+echo begin kill
+for i in `seq 1 5`; do
+ pkill -f "$SHEEP $STORE/$i -z $i -p 700$i"
+ sleep 3
+done
+
+for i in `seq 1 5`; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+
+echo wait for object recovery to finish
+while true; do
+ if [ "$(pgrep collie)" ]; then
+ sleep 1
+ else
+ break
+ fi
+done
+
+for i in `seq 0 7`; do
+ for j in `seq 0 4`; do
+ $COLLIE vdi read test$j -p 700$i | md5sum
+ done
+done
diff --git a/tests/store/002.sh b/tests/store/002.sh
new file mode 100755
index 0000000..ffb1024
--- /dev/null
+++ b/tests/store/002.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+# start three sheep daemons
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+
+sleep 1
+$COLLIE cluster format -c 2
+
+# create a pre-allocated vdi
+$COLLIE vdi create test 80M -P
+
+# stop the 3rd node
+pkill -f "$SHEEP $STORE/2"
+
+# write data to the vdi
+cat /dev/urandom | $COLLIE vdi write test
+
+# restart the 3rd node
+$SHEEP $STORE/2 -z 2 -p 7002 -c $DRIVER
+
+# wait for object recovery to finish
+sleep 10
+
+# show md5sum of the vdi on each node
+for i in 0 1 2; do
+ $COLLIE vdi read test -p 700$i | md5sum
+done
diff --git a/tests/store/003.sh b/tests/store/003.sh
new file mode 100755
index 0000000..1808a6f
--- /dev/null
+++ b/tests/store/003.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+$SHEEP $STORE/0 -z 0 -p 7000 -c $DRIVER
+$SHEEP $STORE/1 -z 1 -p 7001 -c $DRIVER
+$COLLIE cluster format -c 2
+$COLLIE cluster recover disable
+
+qemu-img create sheepdog:test 4G
+
+# create 20 objects
+for i in `seq 0 19`; do
+ $COLLIE vdi write test $((i * 4 * 1024 * 1024)) 512 < /dev/zero
+done
+
+$SHEEP $STORE/2 -z 2 -p 7002 -c $DRIVER
+
+# overwrite the objects
+for i in `seq 0 19`; do
+ $COLLIE vdi write test $((i * 4 * 1024 * 1024)) 512 < /dev/zero
+done
diff --git a/tests/store/004.sh b/tests/store/004.sh
new file mode 100755
index 0000000..d978a4e
--- /dev/null
+++ b/tests/store/004.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+dd if=/dev/zero of=$STORE/0.img seek=$((2 * 1024 ** 3 - 1)) bs=1 count=1
+dd if=/dev/zero of=$STORE/1.img seek=$((4 * 1024 ** 3 - 1)) bs=1 count=1
+dd if=/dev/zero of=$STORE/2.img seek=$((8 * 1024 ** 3 - 1)) bs=1 count=1
+
+for i in 0 1 2; do
+ mkfs.xfs $STORE/$i.img
+ mkdir $STORE/$i
+ mount -o loop $STORE/$i.img $STORE/$i
+ $SHEEP $STORE/$i/ -z $i -p 700$i -c $DRIVER
+done
+
+sleep 1
+
+echo check the number of vnodes
+for i in 0 1 2; do
+ $COLLIE node list -p 700$i
+done
diff --git a/tests/store/005.sh b/tests/store/005.sh
new file mode 100755
index 0000000..21208fa
--- /dev/null
+++ b/tests/store/005.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i/ -z $i -p 700$i -c $DRIVER
+done
+
+# add gateway node
+$SHEEP $STORE/4/ -z 4 -p 7004 -c $DRIVER -g
+
+sleep 1
+
+echo check the number of vnodes
+$COLLIE node list
diff --git a/tests/test_membership.py b/tests/test_membership.py
deleted file mode 100644
index a670278..0000000
--- a/tests/test_membership.py
+++ /dev/null
@@ -1,70 +0,0 @@
-from sheepdog_test import *
-import time
-
-
-def test_simultaneous_startup():
- """Start multiple sheep daemons at the same time"""
-
- nr_nodes = 8
- sdog = Sheepdog(nr_nodes)
-
- # start 8 daemons at the same time
- for n in sdog.nodes:
- n.start()
-
- for n in sdog.nodes:
- n.wait()
-
- for n in sdog.nodes:
- p = n.run_collie('node list -r')
- (out, _) = p.communicate()
- assert len(out.splitlines()) == nr_nodes
-
-
-def test_mastership():
- """Check master transfer."""
-
- nr_nodes = 3
- sdog = Sheepdog(nr_nodes)
-
- sdog.nodes[0].start()
- sdog.nodes[0].wait()
-
- # start Sheepdog with one node
- p = sdog.format()
- p.wait()
-
- sdog.nodes[1].start()
- sdog.nodes[1].wait()
-
- # give mastership to nodes[1]
- sdog.nodes[0].stop()
-
- sdog.nodes[2].start()
- sdog.nodes[2].wait()
-
- # give mastership to nodes[2]
- sdog.nodes[1].stop()
-
- # FIXME: wait until nodes[2] updates membership
- time.sleep(0.5)
- sdog.nodes[2].stop()
-
- for n in sdog.nodes:
- n.start()
- n.wait()
-
- # only nodes[2] should be in the cluster
- p = sdog.nodes[2].run_collie('node list -r')
- (out, _) = p.communicate()
- assert len(out.splitlines()) == 1
-
- sdog.nodes[0].start()
- sdog.nodes[0].wait()
- sdog.nodes[1].start()
- sdog.nodes[1].wait()
-
- for n in sdog.nodes:
- p = n.run_collie('node list -r')
- (out, _) = p.communicate()
- assert len(out.splitlines()) == nr_nodes
diff --git a/tests/test_qemu_io.py b/tests/test_qemu_io.py
deleted file mode 100644
index b063833..0000000
--- a/tests/test_qemu_io.py
+++ /dev/null
@@ -1,83 +0,0 @@
-from sheepdog_test import *
-from qemu_io_testcases import *
-import time
-
-def test_io():
-
- cmd = ["qemu-io"]
- sdog = Sheepdog()
-
- for n in sdog.nodes:
- n.start()
- n.wait()
-
- p = sdog.format()
- p.wait()
-
- for i in io_cases:
- vdi = sdog.create_vdi(str(i), size_cases[i])
- vdi.wait()
- time.sleep(1)
- vm = n.create_vm(vdi)
- for j in io_cases[i]:
- (out, err) = vm.test_io(cmd, j[0] + "\n")
- assert out == j[1]
- time.sleep(1)
- print "Pass"
- vdi.destroy()
- vdi.wait()
-
- p = sdog.format()
- p.wait()
- for n in sdog.nodes:
- n.stop()
-
-def test_aio():
-
- cmd = ["qemu-io"]
- sdog = Sheepdog()
-
- for n in sdog.nodes:
- n.start()
- n.wait()
-
- p = sdog.format()
- p.wait()
-
- for i in aio_cases:
- vdi = sdog.create_vdi(str(i), size_cases[i])
- vdi.wait()
- time.sleep(1)
- vm = n.create_vm(vdi)
- for j in aio_cases[i]:
- (out, err) = vm.test_io(cmd, j[0] + "\n", async=True)
- assert out == j[1]
- time.sleep(1)
- print "Pass"
- vdi.destroy()
- vdi.wait()
-
-def test_growable_io():
-
- cmd = ["qemu-io", "-g"]
- sdog = Sheepdog()
-
- for n in sdog.nodes:
- n.start()
- n.wait()
-
- p = sdog.format()
- p.wait()
-
- for i in io_cases_g:
- vdi = sdog.create_vdi(str(i), size_cases[i])
- vdi.wait()
- time.sleep(1)
- vm = n.create_vm(vdi)
- for j in io_cases_g[i]:
- (out, err) = vm.test_io(cmd, j[0] + "\n")
- assert out == j[1]
- time.sleep(1)
- print "Pass"
- vdi.destroy()
- vdi.wait()
diff --git a/tests/test_vdi.py b/tests/test_vdi.py
deleted file mode 100644
index b77562d..0000000
--- a/tests/test_vdi.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from sheepdog_test import *
-import time
-
-
-def test_create_vdi():
- """Create many VDIs at the same time."""
-
- nr_vdis = 5
- sdog = Sheepdog()
-
- for n in sdog.nodes:
- n.start()
- n.wait()
-
- p = sdog.format()
- p.wait()
-
- # create VDIs at the same time
- vdis = [sdog.create_vdi(str(i), 4 * 1024 ** 3) for i in range(nr_vdis)]
- for v in vdis:
- v.wait()
-
- time.sleep(1)
- p = n.run_collie('vdi list -r')
- (out, _) = p.communicate()
- assert len(out.splitlines()) == nr_vdis
diff --git a/tests/vdi/001.sh b/tests/vdi/001.sh
new file mode 100755
index 0000000..26a39c1
--- /dev/null
+++ b/tests/vdi/001.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -p 700$i -z $i -c $DRIVER
+done
+
+sleep 1
+
+$COLLIE cluster format -c 1
+
+qemu-img create sheepdog:test 4G
+for i in `seq 1 9`; do
+ qemu-io -c "write 0 512 -P $i" sheepdog:test
+ qemu-img snapshot -c tag$i sheepdog:test
+done
+
+qemu-io -c "read 0 512 -P 9" sheepdog:test
+for i in `seq 1 9`; do
+ qemu-io -c "read 0 512 -P $i" sheepdog:test:tag$i
+done
diff --git a/tests/vdi/002.sh b/tests/vdi/002.sh
new file mode 100755
index 0000000..2f7cf3d
--- /dev/null
+++ b/tests/vdi/002.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+
+sleep 1
+
+$COLLIE cluster format -c 2
+$COLLIE vdi create test 4G
+
+echo -n value > $STORE/tmp.dat
+
+echo "key shouldn't be found"
+$COLLIE vdi getattr test key || true
+
+$COLLIE vdi setattr test key value
+$COLLIE vdi getattr test key | diff - $STORE/tmp.dat
+
+$COLLIE vdi setattr test key value -d
+
+echo "key shouldn't be found"
+$COLLIE vdi getattr test key || true
diff --git a/tests/vdi/003.sh b/tests/vdi/003.sh
new file mode 100755
index 0000000..c39c9bd
--- /dev/null
+++ b/tests/vdi/003.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 2; do
+ $SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
+done
+
+sleep 1
+
+$COLLIE cluster format -c 2
+$COLLIE vdi create test 539545600
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi write test 512 512 < /dev/zero
+echo "there should be 3 setattr errors"
+
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi write test 512 512 < /dev/zero
+echo "there should be 8 setattr errors"
+
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi write test 512 512 < /dev/zero
+echo "there should be 6 setattr errors"
+
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi setattr test lock 1 -x &
+$COLLIE vdi write test 512 512 < /dev/zero
+echo "there should be 5 setattr errors"
diff --git a/tests/vdi/004.sh b/tests/vdi/004.sh
new file mode 100755
index 0000000..91fe654
--- /dev/null
+++ b/tests/vdi/004.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -p 700$i -z $i -c $DRIVER
+done
+
+sleep 1;
+
+$COLLIE cluster format -c 3
+$COLLIE vdi create base 100M -P
+
+qemu-img snapshot -c tag sheepdog:base
+
+sleep 1
+
+$COLLIE vdi clone -s 1 base test
+
+sleep 1
+
+$COLLIE vdi delete test
+
+sleep 1
+$COLLIE vdi delete base
+
+sleep 1
+$COLLIE vdi delete -s 1 base
+
+sleep 3
+echo there should be no vdi
+$COLLIE vdi list
+
+echo there should be no object
+$COLLIE node info
diff --git a/tests/vdi/005.sh b/tests/vdi/005.sh
new file mode 100755
index 0000000..b80a6f4
--- /dev/null
+++ b/tests/vdi/005.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -ex
+
+DRIVER=${DRIVER:-local}
+STORE=${STORE:-/tmp/sheepdog}
+SHEEP=${SHEEP:-./sheep/sheep}
+COLLIE=${COLLIE:-./collie/collie}
+
+killall -9 sheep collie || true
+sleep 1
+rm -r $STORE/* || true
+mkdir -p $STORE
+
+for i in 0 1 2; do
+ $SHEEP $STORE/$i -p 700$i -z $i -c $DRIVER
+done
+
+sleep 1
+
+$COLLIE cluster format -c 1
+
+qemu-img create sheepdog:test 4G
+qemu-img snapshot -c tag1 sheepdog:test
+qemu-img snapshot -c tag2 sheepdog:test
+qemu-img snapshot -c tag3 sheepdog:test
+
+qemu-img create sheepdog:test2 4G
+qemu-img snapshot -c tag1 sheepdog:test2
+qemu-img snapshot -c tag2 sheepdog:test2
+qemu-io -c "write 0 512" sheepdog:test2:1
+qemu-img snapshot -c tag3 sheepdog:test2
+
+$COLLIE vdi tree
+
+# expected results:
+#
+# test---[2012-08-07 18:04]---[2012-08-07 18:04]---[2012-08-07 18:04]---(you are here)
+# test2---[2012-08-07 18:04]-+-[2012-08-07 18:04]---[2012-08-07 18:04]
+# `-[2012-08-07 18:04]---(you are here)
--
1.7.2.5
More information about the sheepdog
mailing list