]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/mgr: restructure dashboard tests 20768/head
authorKefu Chai <kchai@redhat.com>
Wed, 7 Mar 2018 09:17:24 +0000 (17:17 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 7 Mar 2018 09:27:36 +0000 (17:27 +0800)
* restructure dashboard tests so they follow the model of other tests
  based on ceph-helpers.sh. i.e. extract the TEST_* out of run()
  function.
* expose mon-host using CEPH_ARGS env variable.
* mgr-dashboard_v2-smoke.sh: do not export CEPH_ARGS in a subshell, so
  the run_mgr() and ceph cli can also have access to the updated
  CEPH_ARGS, and hence they will be able to locate the mon. and because
  auth-supported=none is populated using CEPH_ARGS, this test won't fail
  because of missing keyring.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/mgr/mgr-dashboard-smoke.sh
src/test/mgr/mgr-dashboard_v2-smoke.sh

index edd24711422fbb59c2321fb1115f5c0e2a6889e8..b59880a0722cf20c795f62a529c4774574578bc7 100755 (executable)
@@ -18,20 +18,24 @@ source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
 function run() {
     local dir=$1
 
-    setup $dir || return 1
-
-    MON=127.0.0.1:7150  # git grep '\<7150\>' : there must be only one
-
-    FSID=$(uuidgen)
-    CEPH_ARGS+="--fsid=$FSID --auth-supported=none "
+    export CEPH_MON=127.0.0.1:7150  # git grep '\<7150\>' : there must be only one
+    export CEPH_ARGS
+    CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
     CEPH_ARGS+="--mon-initial-members=a --mon-host=$MON "
     CEPH_ARGS+="--mgr-initial-modules=dashbaord "
-    CEPH_ARGS+="--mon-host=$MON"
-    export CEPH_ARGS
+    CEPH_ARGS+="--mon-host=$CEPH_MON"
+
+    setup $dir || return 1
+    TEST_dashboard $dir || return 1
+    teardown $dir || return 1
+}
 
-    run_mon $dir a --public-addr $MON || return 1
+function TEST_dashboard() {
+    local dir=$1
+    shift
 
-    timeout 360 ceph --mon-host $MON mon stat || return 1
+    run_mon $dir a || return 1
+    timeout 360 ceph mon stat || return 1
     ceph config-key set mgr/x/dashboard/server_port 7001
     MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
     run_mgr $dir x ${MGR_ARGS} || return 1
@@ -56,8 +60,6 @@ function run() {
         tries=$((tries+1))
         sleep 0.5
     done
-
-    teardown $dir || return 1
 }
 
 main mgr-dashboard-smoke "$@"
index b2de7d0a41b2c3ec252e39c485a2326d3a9a5481..b0eb325e8bcc59e7ecf65bfe1caec04a31676499 100755 (executable)
@@ -18,22 +18,26 @@ source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
 
 function run() {
     local dir=$1
+    shift
+
+    export CEPH_MON=127.0.0.1:7160  # git grep '\<7160\>' : there must be only one
+    export CEPH_ARGS
+    CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
+    CEPH_ARGS+="--mon-initial-members=a --mon-host=$MON "
+    CEPH_ARGS+="--mgr-initial-modules=dashbaord_v2 "
+    CEPH_ARGS+="--mon-host=$CEPH_MON"
 
     setup $dir || return 1
+    TEST_dashboardv2 $dir || return 1
+    teardown $dir || return 1
+}
 
-    MON=127.0.0.1:7160  # git grep '\<7160\>' : there must be only one
-    (
-        FSID=$(uuidgen)
-        export CEPH_ARGS
-        CEPH_ARGS+="--fsid=$FSID --auth-supported=none "
-        CEPH_ARGS+="--mon-initial-members=a --mon-host=$MON "
-        CEPH_ARGS+="--mgr-initial-modules=dashbaord_v2 "
-        CEPH_ARGS+="--mon-host=$MON"
-        run_mon $dir a --public-addr $MON || return 1
-    )
+function TEST_dashboardv2() {
+    local dir=$1
+    shift
 
-    timeout 30 ceph --mon-host $MON mon stat || return 1
-    export CEPH_ARGS="--mon_host $MON "
+    run_mon $dir a || return 1
+    timeout 30 ceph mon stat || return 1
     ceph config-key set mgr/dashboard_v2/x/server_port 7161
     MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
     run_mgr $dir x ${MGR_ARGS} || return 1
@@ -62,8 +66,6 @@ function run() {
         tries=$((tries+1))
         sleep 0.5
     done
-
-    teardown $dir || return 1
 }
 
 main mgr-dashboard_v2-smoke "$@"