From: Loic Dachary Date: Sat, 16 May 2015 09:23:07 +0000 (+0200) Subject: tests: test/mon/osd-crush.sh uses ceph-helpers.sh X-Git-Tag: v9.0.2~146^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7aca4701a430952227d6b3a5bae392a218fa0f80;p=ceph.git tests: test/mon/osd-crush.sh uses ceph-helpers.sh 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 --- diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 4b1c601d41a..4857ca2b259 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2014 Cloudwatt -# Copyright (C) 2014 Red Hat +# Copyright (C) 2014, 2015 Red Hat # # Author: Loic Dachary # @@ -15,30 +15,30 @@ # 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 'take[^<]+default' | \ grep 'choose_firstn0osd' || 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"