app-catalog/run_tests.sh
Kevin Fox 6cc4bf752b Python Server
This enables the server to be switched over to being Python
rather than just doing static files. This allows for:
 * Dynamic API.
 * Faster loads due to supporting compression of Javascript.
 * Javascript/CSS from local webserver rather then remote.
 * XStatic managed Javascript/CSS.
 * Sharing code between the app-catalog and Horizon.

This patch set enables most of the infrastructure to do that
and copies in the initial website. Minimal changes have been
made to the site to make it compatible with the new code.

Further reviews will switch the site to use more of the new
functionality.

Co-Authored-By: Christopher Aedo <doc@aedo.net>

Change-Id: I2fa9686d3e5db4ee43a02aa7d09b998472e02bf6
2015-11-19 14:13:06 -08:00

71 lines
1.6 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..."
$root/tools/update_assets.sh
if [ ! -d $venv ]; then
virtualenv $venv
. $venv/bin/activate
fi
. $venv/bin/activate
pip install -r $root/requirements.txt
#FIXME make venv cleaner.
# FIXME remove when CORS works
# pushd $root/openstack_catalog/web > /dev/null
# ${command_wrapper} python $root/tools/testserver.py runserver $testopts $testargs
${command_wrapper} python manage.py runserver $testopts $testargs
# popd > /dev/null
echo "Server stopped."
}
# Development server
if [ $runserver -eq 1 ]; then
if [ "x$testargs" = "x" -o "$testargs x" = " x" ]; then
testargs="127.0.0.1:18001"
fi
run_server
exit $?
fi