app-catalog/run_tests.sh
Kevin Fox 288497c020 Merge asset files. Add v1 API.
This finishes the Asset type merging into one file work. This will
permit new types of assets to be easily added in the future. It
also cleans out a few old schema files, and produces the final
assets.json file in api/v1/assets.json

Implements: blueprint v1-api

Implements: merge-asset-yamls

Partially-Implements: blueprint expand-asset-types

Change-Id: I59012e67f1e02fc236971ac92f2bd39e67929ea8
2015-08-27 12:39:22 -07:00

59 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -o errexit
function usage {
echo "Usage: $0 [OPTION]..."
echo "Run App Catalog's test suite(s)"
echo ""
echo " --runserver Run the development server for"
echo " openstack_catalog in the virtual"
echo " environment."
echo " -h, --help Print this usage message"
echo ""
exit
}
# DEFAULTS FOR RUN_TESTS.SH
#
root=`pushd $(dirname $0) > /dev/null; pwd; popd > /dev/null`
venv=$root/.venv
runserver=0
testopts=""
testargs=""
# Jenkins sets a "JOB_NAME" variable, if it's not set, we'll make it "default"
[ "$JOB_NAME" ] || JOB_NAME="default"
function process_option {
case "$1" in
-h|--help) usage;;
--runserver) runserver=1;;
-*) testopts="$testopts $1";;
*) testargs="$testargs $1"
esac
}
# PROCESS ARGUMENTS, OVERRIDE DEFAULTS
for arg in "$@"; do
process_option $arg
done
function run_server {
echo "Starting development server..."
pushd $root/openstack_catalog/web > /dev/null
mkdir -p api/v1/
python $root/tools/yaml2json.py < static/assets.yaml > api/v1/assets
${command_wrapper} python $root/tools/testserver.py runserver $testopts $testargs
popd > /dev/null
echo "Server stopped."
}
# Development server
if [ $runserver -eq 1 ]; then
run_server
exit $?
fi