From: Patrick Nawracay Date: Wed, 30 May 2018 14:00:40 +0000 (+0200) Subject: mgr/dashboard: Extend dev scripts for API testing X-Git-Tag: v14.0.1~1100^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ef5756b5fff64167c328e6017647cf53ed06d289;p=ceph-ci.git mgr/dashboard: Extend dev scripts for API testing Signed-off-by: Patrick Nawracay --- diff --git a/src/pybind/mgr/dashboard/run-backend-api-request.sh b/src/pybind/mgr/dashboard/run-backend-api-request.sh index d52bc174b3e..1dad7d636d2 100755 --- a/src/pybind/mgr/dashboard/run-backend-api-request.sh +++ b/src/pybind/mgr/dashboard/run-backend-api-request.sh @@ -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 "" diff --git a/src/pybind/mgr/dashboard/run-backend-api-tests.sh b/src/pybind/mgr/dashboard/run-backend-api-tests.sh index e7b78e91269..2a3c40eb36c 100755 --- a/src/pybind/mgr/dashboard/run-backend-api-tests.sh +++ b/src/pybind/mgr/dashboard/run-backend-api-tests.sh @@ -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