]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Extend dev scripts for API testing 21998/head
authorPatrick Nawracay <pnawracay@suse.com>
Wed, 30 May 2018 14:00:40 +0000 (16:00 +0200)
committerPatrick Nawracay <pnawracay@suse.com>
Fri, 15 Jun 2018 08:26:30 +0000 (10:26 +0200)
Signed-off-by: Patrick Nawracay <pnawracay@suse.com>
src/pybind/mgr/dashboard/run-backend-api-request.sh
src/pybind/mgr/dashboard/run-backend-api-tests.sh

index d52bc174b3e1f87fc4e494afc2bd7c06f0e2de42..1dad7d636d281e538842d4330185005c4f2d9b78 100755 (executable)
@@ -3,13 +3,16 @@
 CURR_DIR=`pwd`
 cd ../../../../build
 API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
+if [ "$API_URL" = "null" ]; then
+       echo "Couldn't retrieve API URL, exiting..." >&2
+       exit 1
+fi
 cd $CURR_DIR
 
 curl --insecure  -s -c /tmp/cd-cookie.txt -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"admin"}'  $API_URL/api/auth > /dev/null
 
-echo "API_ENDPOINT: $API_URL"
 echo "METHOD: $1"
-echo "PATH: $2"
+echo "URL: ${API_URL}${2}"
 echo "DATA: $3"
 echo ""
 
index e7b78e91269bf00c7a17583128e8c156a4844aa9..2a3c40eb36c83f1716c3e8141e0b7647d34270ef 100755 (executable)
@@ -1,18 +1,21 @@
 #!/usr/bin/env bash
 
-
-
-# Usage (run from ./):
-# ./run-backend-api-tests.sh
-# ./run-backend-api-tests.sh [tests]...
-#
-# Example:
-# ./run-backend-api-tests.sh tasks.mgr.dashboard.test_pool.DashboardTest
-#
-# Or source this script. Allows to re-run tests faster:
-# $ source run-backend-api-tests.sh
-# $ run_teuthology_tests [tests]...
-# $ cleanup_teuthology
+if [[ "$1" = "-h" || "$1" = "--help" ]]; then
+       echo "Usage (run from ./):"
+       echo -e "\t./run-backend-api-tests.sh"
+       echo -e "\t./run-backend-api-tests.sh [tests]..."
+       echo
+       echo "Example:"
+       echo -e "\t./run-backend-api-tests.sh tasks.mgr.dashboard.test_pool.DashboardTest"
+       echo
+       echo "Or source this script. This allows to re-run tests faster:"
+       echo -e "\tsource run-backend-api-tests.sh"
+       echo -e "\trun_teuthology_tests [tests]..."
+       echo -e "\tcleanup_teuthology"
+       echo
+
+       exit 0
+fi
 
 # creating temp directory to store virtualenv and teuthology