3 # Copyright (C) 2014,2015,2017 Red Hat <contact@redhat.com>
4 # Copyright (C) 2018 SUSE LLC
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Library Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Library Public License for more details.
16 source $
(dirname $0)/..
/detect-build-env-vars.sh
17 source $CEPH_ROOT/qa
/standalone
/ceph-helpers.sh
19 mon_port
=$
(get_unused_port
)
20 dashboard_port
=$
((mon_port
+1))
26 export CEPH_MON
=127.0.0.1:$mon_port
28 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
29 CEPH_ARGS
+="--mon-initial-members=a --mon-host=$MON "
30 CEPH_ARGS
+="--mgr-initial-modules=dashboard "
31 CEPH_ARGS
+="--mon-host=$CEPH_MON"
33 setup
$dir ||
return 1
34 TEST_dashboard
$dir ||
return 1
35 teardown
$dir ||
return 1
38 function TEST_dashboard
() {
42 run_mon
$dir a ||
return 1
43 timeout
30 ceph mon stat ||
return 1
44 ceph config-key
set mgr
/dashboard
/x
/server_port
$dashboard_port
45 MGR_ARGS
+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
46 run_mgr
$dir x
${MGR_ARGS} ||
return 1
49 while [[ $tries < 30 ]] ; do
50 if [ $
(ceph status
-f json | jq .mgrmap.available
) = "true" ]
58 DASHBOARD_ADMIN_SECRET_FILE
="/tmp/dashboard-admin-secret.txt"
59 printf 'admin' > "${DASHBOARD_ADMIN_SECRET_FILE}"
60 ceph_adm dashboard ac-user-create admin
-i "${DASHBOARD_ADMIN_SECRET_FILE}" --force-password
63 while [[ $tries < 30 ]] ; do
64 if curl
-c $dir/cookiefile
-X POST
-d '{"username":"admin","password":"admin"}' http
://127.0.0.1:$dashboard_port/api
/auth
66 if curl
-b $dir/cookiefile
-s http
://127.0.0.1:$dashboard_port/api
/summary | \
67 jq
'.health.overall_status' |
grep HEALTH_
77 main mgr-dashboard-smoke
"$@"
80 # compile-command: "cd ../.. ; make -j4 TESTS=test/mgr/mgr-dashboard-smoke.sh check"