]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/mgr/mgr-dashboard-smoke.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / test / mgr / mgr-dashboard-smoke.sh
index 778b36f3520c065ba5ffa0d2db9862ff3508e6b7..582909a6ed545067b9c30a66706c9f429d07e499 100755 (executable)
@@ -1,6 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Copyright (C) 2014,2015,2017 Red Hat <contact@redhat.com>
+# Copyright (C) 2018 SUSE LLC
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Library Public License as published by
@@ -17,23 +18,27 @@ 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=dashboard "
+    CEPH_ARGS+="--mon-host=$CEPH_MON"
 
     setup $dir || return 1
+    TEST_dashboard $dir || return 1
+    teardown $dir || return 1
+}
 
-    MON=127.0.0.1:7150  # git grep '\<7150\>' : 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 "
-       CEPH_ARGS+="--mon-host=$MON"
-        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
-    export CEPH_ARGS="--mon_host $MON "
-    ceph config-key set mgr/x/dashboard/server_port 7001
+    run_mon $dir a || return 1
+    timeout 30 ceph mon stat || return 1
+    ceph config-key set mgr/dashboard/x/server_port 7161
     MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
     run_mgr $dir x ${MGR_ARGS} || return 1
 
@@ -46,23 +51,25 @@ function run() {
         tries=$((tries+1))
         sleep 1
     done
+    ceph_adm tell mgr dashboard set-login-credentials admin admin
 
     tries=0
     while [[ $tries < 30 ]] ; do
-        if [ curl -s http://127.0.0.1:7001/toplevel_data | \
-             jq '.health.overall_status' | grep HEALTH_ ]
+        if curl -c $dir/cookiefile -X POST -d '{"username":"admin","password":"admin"}' http://127.0.0.1:7161/api/auth
         then
-            break
+            if curl -b $dir/cookiefile -s http://127.0.0.1:7161/api/summary | \
+                 jq '.health.overall_status' | grep HEALTH_
+            then
+                break
+            fi
         fi
         tries=$((tries+1))
         sleep 0.5
     done
-
-    teardown $dir || return 1
 }
 
 main mgr-dashboard-smoke "$@"
 
 # Local Variables:
-# compile-command: "cd ../.. ; make -j4 TESTS=test/mon/mon-dashboard-smoke.sh check"
+# compile-command: "cd ../.. ; make -j4 TESTS=test/mgr/mgr-dashboard-smoke.sh check"
 # End: