Merge pull request #35585 from tchaikov/wip-test-mgr-dashboard-smoke-random-port

test/mgr/mgr-dashboard-smoke: listen on random ports

Reviewed-by: Laura Paduano <lpaduano@suse.com>
This commit is contained in:
Kefu Chai 2020-06-16 22:34:59 +08:00 committed by GitHub
commit e3cad286a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,11 +16,14 @@
source $(dirname $0)/../detect-build-env-vars.sh
source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
mon_port=$(get_unused_port)
dashboard_port=$((mon_port+1))
function run() {
local dir=$1
shift
export CEPH_MON=127.0.0.1:7160 # git grep '\<7160\>' : there must be only one
export CEPH_MON=127.0.0.1:$mon_port
export CEPH_ARGS
CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
CEPH_ARGS+="--mon-initial-members=a --mon-host=$MON "
@ -38,7 +41,7 @@ function TEST_dashboard() {
run_mon $dir a || return 1
timeout 30 ceph mon stat || return 1
ceph config-key set mgr/dashboard/x/server_port 7161
ceph config-key set mgr/dashboard/x/server_port $dashboard_port
MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
run_mgr $dir x ${MGR_ARGS} || return 1
@ -55,9 +58,9 @@ function TEST_dashboard() {
tries=0
while [[ $tries < 30 ]] ; do
if curl -c $dir/cookiefile -X POST -d '{"username":"admin","password":"admin"}' http://127.0.0.1:7161/api/auth
if curl -c $dir/cookiefile -X POST -d '{"username":"admin","password":"admin"}' http://127.0.0.1:$dashboard_port/api/auth
then
if curl -b $dir/cookiefile -s http://127.0.0.1:7161/api/summary | \
if curl -b $dir/cookiefile -s http://127.0.0.1:$dashboard_port/api/summary | \
jq '.health.overall_status' | grep HEALTH_
then
break