]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: test/mon/mon-handle-forward.sh uses ceph-helpers.sh
authorLoic Dachary <ldachary@redhat.com>
Sat, 16 May 2015 13:49:39 +0000 (15:49 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sun, 17 May 2015 11:31:25 +0000 (13:31 +0200)
Use ceph-helpers.sh instead of  mon/mon-test-helpers.sh.

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

  * use explicit ports 7300 and 7301 instead of +1 so that grep
    will show that 7301 is used. This reduces the odds of a
    port collision when looking for a port that's not already
    used by an existing test.

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

index aefac9eae07c9040525952365ef9cd41119c61e3..54104207ccafadfd6e2a02cb5ca7b4c60231ab63 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (C) 2013 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
 
-    PORT=7300 # CEPH_MON=
-    MONA=127.0.0.1:$PORT
-    MONB=127.0.0.1:$(($PORT + 1))
+    MONA=127.0.0.1:7300
+    MONB=127.0.0.1:7301
     (
         FSID=$(uuidgen) 
         export CEPH_ARGS
         CEPH_ARGS+="--fsid=$FSID --auth-supported=none "
         CEPH_ARGS+="--mon-initial-members=a,b --mon-host=$MONA,$MONB "
-        run_mon $dir a --public-addr $MONA
-        run_mon $dir b --public-addr $MONB
+        run_mon $dir a --public-addr $MONA || return 1
+        run_mon $dir b --public-addr $MONB || return 1
     )
 
     timeout 360 ./ceph --mon-host $MONA mon stat || return 1
     # check that MONB is indeed a peon
-    ./ceph --admin-daemon $dir/b/ceph-mon.b.asok mon_status | 
+    ./ceph --admin-daemon $dir/ceph-mon.b.asok mon_status |
        grep '"peon"' || return 1
     # when the leader ( MONA ) is used, there is no message forwarding
     ./ceph --mon-host $MONA osd pool create POOL1 12 
-    grep 'mon_command(.*"POOL1"' $dir/a/log 
-    grep 'mon_command(.*"POOL1"' $dir/b/log && return 1
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
+    grep 'mon_command(.*"POOL1"' $dir/a/mon.a.log
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-mon.b.asok log flush || return 1
+    grep 'mon_command(.*"POOL1"' $dir/mon.b.log && return 1
     # when the peon ( MONB ) is used, the message is forwarded to the leader
-    ./ceph --mon-host $MONB osd pool create POOL2 12 
-    grep 'forward_request.*mon_command(.*"POOL2"' $dir/b/log
-    grep ' forward(mon_command(.*"POOL2"' $dir/a/log 
+    ./ceph --mon-host $MONB osd pool create POOL2 12
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-mon.b.asok log flush || return 1
+    grep 'forward_request.*mon_command(.*"POOL2"' $dir/mon.b.log
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1
+    grep ' forward(mon_command(.*"POOL2"' $dir/mon.a.log
     # forwarded messages must retain features from the original connection
     features=$(sed -n -e 's|.*127.0.0.1:0.*accept features \([0-9][0-9]*\)|\1|p' < \
-        $dir/b/log)
-    grep ' forward(mon_command(.*"POOL2".*con_features '$features $dir/a/log
+        $dir/mon.b.log)
+    grep ' forward(mon_command(.*"POOL2".*con_features '$features $dir/mon.a.log
 }
 
-main mon-handle-forward
+main mon-handle-forward "$@"
 
 # Local Variables:
-# compile-command: "cd ../.. ; make TESTS=test/mon/mon-handle-forward.sh check"
+# compile-command: "cd ../.. ; make -j4 TESTS=test/mon/mon-handle-forward.sh check"
 # End: