]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: add test_setup_dev_and_run to ceph-disk.sh
authorLoic Dachary <ldachary@redhat.com>
Wed, 1 Apr 2015 12:54:10 +0000 (14:54 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sun, 5 Apr 2015 23:58:18 +0000 (01:58 +0200)
Move test_activate_dev to test_setup_dev_and_run and make it
run the function given in argument. test_activate_dev calls
test_setup_dev_and_run and no longer needs to implement device
allocation or destruction.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/ceph-disk.sh

index fec0e1e2287614cf0c3b6ab2b77dad5f26a210ce..efdc43e7f1e0ab44b33ab507d16f653406fe9620 100755 (executable)
@@ -475,6 +475,11 @@ function activate_dev_body() {
 }
 
 function test_activate_dev() {
+    test_setup_dev_and_run activate_dev_body
+}
+
+function test_setup_dev_and_run() {
+    local action=$1
     if test $(id -u) != 0 ; then
         echo "SKIP because not root"
         return 0
@@ -490,9 +495,8 @@ function test_activate_dev() {
     local newdisk
     newdisk=$(create_dev $dir/vdh.disk) || return 1
 
-    activate_dev_body $disk $journal $newdisk
+    $action $disk $journal $newdisk
     status=$?
-    test $status != 0 && teardown
 
     destroy_dev $dir/vdf.disk $disk
     destroy_dev $dir/vdg.disk $journal