]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/mgr/mgr-dashboard-smoke: listen on random ports 35585/head
authorKefu Chai <kchai@redhat.com>
Tue, 16 Jun 2020 08:28:01 +0000 (16:28 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 16 Jun 2020 08:30:55 +0000 (16:30 +0800)
in hope to reduce the chance to listen an already used port while
running multiple "make check" instances in parallel.

See-also: http://tracker.ceph.com/issues/36737
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/mgr/mgr-dashboard-smoke.sh

index 3a4bbff3fe89a9daa4cfacf193c80219b12f1c69..5ad7877c8b1145838c83e58fd3093d298e56e136 100755 (executable)
 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