From 59221274cb237eb5b412fe50c0163ce4a6fdc0e6 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 7 Mar 2018 17:17:24 +0800 Subject: [PATCH] test/mgr: restructure dashboard tests * 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 --- src/test/mgr/mgr-dashboard-smoke.sh | 26 +++++++++++----------- src/test/mgr/mgr-dashboard_v2-smoke.sh | 30 ++++++++++++++------------ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/test/mgr/mgr-dashboard-smoke.sh b/src/test/mgr/mgr-dashboard-smoke.sh index edd24711422fb..b59880a0722cf 100755 --- a/src/test/mgr/mgr-dashboard-smoke.sh +++ b/src/test/mgr/mgr-dashboard-smoke.sh @@ -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 "$@" diff --git a/src/test/mgr/mgr-dashboard_v2-smoke.sh b/src/test/mgr/mgr-dashboard_v2-smoke.sh index b2de7d0a41b2c..b0eb325e8bcc5 100755 --- a/src/test/mgr/mgr-dashboard_v2-smoke.sh +++ b/src/test/mgr/mgr-dashboard_v2-smoke.sh @@ -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 "$@" -- 2.39.5