]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/mgr/mgr-dashboard-smoke.sh
3c953b996202532dbb1cd74d755a772838e5e177
[ceph.git] / ceph / src / test / mgr / mgr-dashboard-smoke.sh
1 #!/bin/bash
2 #
3 # Copyright (C) 2014,2015,2017 Red Hat <contact@redhat.com>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Library Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Library Public License for more details.
14 #
15 source $(dirname $0)/../detect-build-env-vars.sh
16 source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
17
18 function run() {
19 local dir=$1
20
21 setup $dir || return 1
22
23 MON=127.0.0.1:7150 # git grep '\<7150\>' : there must be only one
24 (
25 FSID=$(uuidgen)
26 export CEPH_ARGS
27 CEPH_ARGS+="--fsid=$FSID --auth-supported=none "
28 CEPH_ARGS+="--mon-initial-members=a --mon-host=$MON"
29 run_mon $dir a --public-addr $MON || return 1
30 )
31
32 timeout 360 ceph --mon-host $MON mon stat || return 1
33 export CEPH_ARGS="--mon_host $MON "
34 ceph config-key put mgr/x/dashboard/server_port 7001
35 MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
36 MGR_ARGS+="--mgr_modules=dashboard "
37 run_mgr $dir x ${MGR_ARGS} || return 1
38
39 tries=0
40 while [[ $tries < 30 ]] ; do
41 if [ $(ceph status -f json | jq .mgrmap.available) = "true" ]
42 then
43 break
44 fi
45 tries=$((tries+1))
46 sleep 1
47 done
48
49 tries=0
50 while [[ $tries < 30 ]] ; do
51 if [ curl -s http://127.0.0.1:7001/toplevel_data | \
52 jq '.health.overall_status' | grep HEALTH_ ]
53 then
54 break
55 fi
56 tries=$((tries+1))
57 sleep 0.5
58 done
59
60 teardown $dir || return 1
61 }
62
63 main mgr-dashboard-smoke "$@"
64
65 # Local Variables:
66 # compile-command: "cd ../.. ; make -j4 TESTS=test/mon/mon-dashboard-smoke.sh check"
67 # End: