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 ""
#!/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