]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: test/mon/osd-crush.sh uses ceph-helpers.sh
authorLoic Dachary <ldachary@redhat.com>
Sat, 16 May 2015 09:23:07 +0000 (11:23 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sun, 17 May 2015 11:31:21 +0000 (13:31 +0200)
It is just a conversion and the behavior is not changed. It involves:

  * calling run_mon from inside each test instead of doing it in run

  * modifying the .asok and .log names to match the ceph-helpers.sh
    conventions

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/mon/osd-crush.sh

index 4b1c601d41aac40d85a5addaa3881332fc916b9a..4857ca2b2595690ce8de68a73289f72f8f9b0e94 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
-# Copyright (C) 2014 Red Hat <contact@redhat.com>
+# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
 #
 # Author: Loic Dachary <loic@dachary.org>
 #
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Library Public License for more details.
 #
-source test/mon/mon-test-helpers.sh
+source test/ceph-helpers.sh
 
 function run() {
     local dir=$1
+    shift
 
     export CEPH_MON="127.0.0.1:7104"
     export CEPH_ARGS
     CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
     CEPH_ARGS+="--mon-host=$CEPH_MON "
 
-    FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
-    for TEST_function in $FUNCTIONS ; do
-       setup $dir || return 1
-       run_mon $dir a --public-addr $CEPH_MON
-       if ! $TEST_function $dir ; then
-         cat $dir/a/log
-         return 1
-       fi
-       teardown $dir || return 1
+    local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
+    for func in $funcs ; do
+        setup $dir || return 1
+        $func $dir || return 1
+        teardown $dir || return 1
     done
 }
 
 function TEST_crush_rule_create_simple() {
     local dir=$1
+
+    run_mon $dir a || return 1
+
     ./ceph --format xml osd crush rule dump replicated_ruleset | \
         egrep '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
         grep '<op>choose_firstn</op><num>0</num><type>osd</type>' || return 1
@@ -57,6 +57,9 @@ function TEST_crush_rule_create_simple() {
 
 function TEST_crush_rule_dump() {
     local dir=$1
+
+    run_mon $dir a || return 1
+
     local ruleset=ruleset1
     ./ceph osd crush rule create-erasure $ruleset || return 1
     local expected
@@ -70,6 +73,9 @@ function TEST_crush_rule_dump() {
 
 function TEST_crush_rule_rm() {
     local ruleset=erasure2
+
+    run_mon $dir a || return 1
+
     ./ceph osd crush rule create-erasure $ruleset default || return 1
     ./ceph osd crush rule ls | grep $ruleset || return 1
     ./ceph osd crush rule rm $ruleset || return 1
@@ -78,6 +84,9 @@ function TEST_crush_rule_rm() {
 
 function TEST_crush_rule_create_erasure() {
     local dir=$1
+
+    run_mon $dir a || return 1
+
     local ruleset=ruleset3
     #
     # create a new ruleset with the default profile, implicitly
@@ -103,8 +112,8 @@ function TEST_crush_rule_create_erasure() {
     ./ceph osd erasure-code-profile rm default || return 1
     ! ./ceph osd erasure-code-profile ls | grep default || return 1
     ./ceph osd crush rule create-erasure $ruleset || return 1
-    CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1
-    grep 'profile default set' $dir/a/log || return 1
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
+    grep 'profile default set' $dir/mon.a.log || return 1
     ./ceph osd erasure-code-profile ls | grep default || return 1
     ./ceph osd crush rule rm $ruleset || return 1
     ! ./ceph osd crush rule ls | grep $ruleset || return 1
@@ -137,6 +146,9 @@ function generate_manipulated_rules() {
 
 function TEST_crush_ruleset_match_rule_when_creating() {
     local dir=$1
+
+    run_mon $dir a || return 1
+
     local root=host1
 
     generate_manipulated_rules $dir
@@ -150,6 +162,9 @@ function TEST_crush_ruleset_match_rule_when_creating() {
 
 function TEST_add_ruleset_failed() {
     local dir=$1
+
+    run_mon $dir a || return 1
+
     local root=host1
 
     ./ceph osd crush add-bucket $root host
@@ -180,6 +195,8 @@ EOF
 function TEST_crush_rename_bucket() {
     local dir=$1
 
+    run_mon $dir a || return 1
+
     ./ceph osd crush add-bucket host1 host
     ! ./ceph osd tree | grep host2 || return 1
     ./ceph osd crush rename-bucket host1 host2 || return 1
@@ -188,7 +205,7 @@ function TEST_crush_rename_bucket() {
     ./ceph osd crush rename-bucket nonexistent something 2>&1 | grep "Error ENOENT" || return 1
 }
 
-main osd-crush
+main osd-crush "$@"
 
 # Local Variables:
 # compile-command: "cd ../.. ; make -j4 && test/mon/osd-crush.sh"