]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard_v2: Added smoke test.
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 1 Mar 2018 08:28:34 +0000 (09:28 +0100)
committerRicardo Dias <rdias@suse.com>
Mon, 5 Mar 2018 13:07:18 +0000 (13:07 +0000)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/test/mgr/CMakeLists.txt
src/test/mgr/mgr-dashboard_v2-smoke.sh [new file with mode: 0755]

index 1ddc60d5962b5192fd7ec74b3cce7f114da56c4e..f557dcb30c1f6020a7d11aa31cee0c7752f22719 100644 (file)
@@ -5,3 +5,5 @@ if(WITH_MGR_DASHBOARD_V2_FRONTEND AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch6
 add_ceph_test(mgr-dashboard_v2-frontend-unittests ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard_v2/run-frontend-unittests.sh)
 endif(WITH_MGR_DASHBOARD_V2_FRONTEND AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64|arm|ARM")
 
+add_ceph_test(mgr-dashboard_v2-smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/mgr-dashboard_v2-smoke.sh)
+
diff --git a/src/test/mgr/mgr-dashboard_v2-smoke.sh b/src/test/mgr/mgr-dashboard_v2-smoke.sh
new file mode 100755 (executable)
index 0000000..b2de7d0
--- /dev/null
@@ -0,0 +1,73 @@
+#!/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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Public License for more details.
+#
+source $(dirname $0)/../detect-build-env-vars.sh
+source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
+
+function run() {
+    local dir=$1
+
+    setup $dir || return 1
+
+    MON=127.0.0.1:7160  # git grep '\<7160\>' : 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_v2 "
+        CEPH_ARGS+="--mon-host=$MON"
+        run_mon $dir a --public-addr $MON || return 1
+    )
+
+    timeout 30 ceph --mon-host $MON mon stat || return 1
+    export CEPH_ARGS="--mon_host $MON "
+    ceph config-key set mgr/dashboard_v2/x/server_port 7161
+    MGR_ARGS+="--mgr_module_path=${CEPH_ROOT}/src/pybind/mgr "
+    run_mgr $dir x ${MGR_ARGS} || return 1
+
+    tries=0
+    while [[ $tries < 30 ]] ; do
+        if [ $(ceph status -f json | jq .mgrmap.available) = "true" ]
+        then
+            break
+        fi
+        tries=$((tries+1))
+        sleep 1
+    done
+    ceph_adm tell mgr dashboard set-login-credentials admin admin
+
+    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
+        then
+            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_v2-smoke "$@"
+
+# Local Variables:
+# compile-command: "cd ../.. ; make -j4 TESTS=test/mgr/mgr-dashboard_v2-smoke.sh check"
+# End: