Allow running zaqarclient for gate tests

This change allows running either tempest or zaqarclient as testsuite in
Zaqar's gate. Ideally, we should focus on bringing as much tests as
possible to zaqarclient. However, we can't just give up on maintaining
tempest tests update. If anything, we should work harder on bringing
these in-tree or just contribute to the project.

Related-to: I1ba10b18560f35f48a7258eaa2a57727617760bd
Depends-on: Ifcf54fa2d4a5bf49b6757b593bb70cdeda8edb2a
Related-to: Idbc2c9fbd5c63db01ce28e4a52d1a917e4360363
Depends-On: I0f1fd4374125d4b489f3804b79a672b39c714421
Change-Id: I36ac3833ad55123fba0ea71259be6d56353d53e1
This commit is contained in:
Flavio Percoco 2015-09-07 18:15:44 +02:00 committed by Flavio Percoco
parent a607d8ea0c
commit 95317c0c13
2 changed files with 53 additions and 14 deletions

View File

@ -24,8 +24,42 @@ export DEVSTACK_GATE_EXERCISES=0
export DEVSTACK_GATE_TIMEOUT=90
export KEEP_LOCALRC=1
export DEVSTACK_GATE_ZAQAR_BACKEND=$1
export DEVSTACK_GATE_ZAQAR_TEST_SUITE=$1
# NOTE(flaper87): Backwards compatibility until `project-config`'s
# patch lands.
export DEVSTACK_GATE_ZAQAR_BACKEND=${2:-$DEVSTACK_GATE_ZAQAR_TEST_SUITE}
export DEVSTACK_LOCAL_CONFIG+=$"
export ZAQAR_BACKEND=$DEVSTACK_GATE_ZAQAR_BACKEND"
export ENABLED_SERVICES
$BASE/new/devstack-gate/devstack-vm-gate.sh
function run_devstack_gate() {
$BASE/new/devstack-gate/devstack-vm-gate.sh
}
function run_tempest_tests() {
export DEVSTACK_GATE_TEMPEST=1
run_devstack_gate
}
function run_zaqarclient_tests() {
run_devstack_gate
cd $BASE/new/python-zaqarclient
source $BASE/new/devstack/openrc
cat /etc/mongodb.conf
ZAQARCLIENT_AUTH_FUNCTIONAL=1 nosetests tests.functional
}
case "$DEVSTACK_GATE_ZAQAR_TEST_SUITE" in
tempest)
run_tempest_tests
;;
zaqarclient)
run_zaqarclient_tests
;;
*)
# NOTE(flaper87): Eventually, this will error
run_zaqarclient_tests
;;
esac

View File

@ -49,7 +49,6 @@ ZAQAR_BIN_DIR=$(get_python_exec_prefix)
# Set up database backend
ZAQAR_BACKEND=${ZAQAR_BACKEND:-mongodb}
# Set Zaqar repository
ZAQAR_REPO=${ZAQAR_REPO:-${GIT_BASE}/openstack/zaqar.git}
ZAQAR_BRANCH=${ZAQAR_BRANCH:-master}
@ -143,6 +142,10 @@ function configure_zaqar {
iniset $ZAQAR_CONF DEFAULT pooling True
iniset $ZAQAR_CONF 'pooling:catalog' enable_virtual_pool True
# NOTE(flaper87): Configure mongodb regardless so we can use it as a pool
# in tests.
configure_mongodb
if [ "$ZAQAR_BACKEND" = 'mongodb' ] ; then
iniset $ZAQAR_CONF drivers message_store mongodb
iniset $ZAQAR_CONF 'drivers:message_store:mongodb' uri mongodb://localhost:27017/zaqar
@ -151,10 +154,10 @@ function configure_zaqar {
iniset $ZAQAR_CONF drivers management_store mongodb
iniset $ZAQAR_CONF 'drivers:management_store:mongodb' uri mongodb://localhost:27017/zaqar_mgmt
iniset $ZAQAR_CONF 'drivers:management_store:mongodb' database zaqar_mgmt
configure_mongodb
elif [ "$ZAQAR_BACKEND" = 'redis' ] ; then
recreate_database zaqar
iniset $ZAQAR_CONF drivers management_store sqlalchemy
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' uri sqlite://
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' uri `database_connection_url zaqar`
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' database zaqar_mgmt
iniset $ZAQAR_CONF drivers message_store redis
@ -171,10 +174,12 @@ function configure_zaqar {
pip_install uwsgi
iniset $ZAQAR_UWSGI_CONF uwsgi http $ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT
iniset $ZAQAR_UWSGI_CONF uwsgi harakiri 60
iniset $ZAQAR_UWSGI_CONF uwsgi processes 1
iniset $ZAQAR_UWSGI_CONF uwsgi threads 4
iniset $ZAQAR_UWSGI_CONF uwsgi wsgi-file $ZAQAR_DIR/zaqar/transport/wsgi/app.py
iniset $ZAQAR_UWSGI_CONF uwsgi callable app
iniset $ZAQAR_UWSGI_CONF uwsgi master true
cleanup_zaqar
}
@ -197,15 +202,12 @@ function configure_mongodb {
pip_install pymongo
if is_ubuntu; then
install_package mongodb-server
sudo sed -i -e "
s|[^ \t]*#[ \t]*\(nssize[ \t]*=.*\$\)|\1|
s|^\(nssize[ \t]*=[ \t]*\).*\$|\1 2047|
" /etc/mongodb.conf
echo "smallfiles = true" | sudo tee --append /etc/mongodb.conf > /dev/null
restart_service mongodb
elif is_fedora; then
install_package mongodb
install_package mongodb-server
sudo sed -i '/--nssize/!s/OPTIONS=\"/OPTIONS=\"--nssize 2047 /' /etc/sysconfig/mongod
sudo sed -i '/--smallfiles/!s/OPTIONS=\"/OPTIONS=\"--smallfiles /' /etc/sysconfig/mongod
restart_service mongod
fi
}
@ -220,18 +222,21 @@ function init_zaqar {
# install_zaqar() - Collect source and prepare
function install_zaqar {
setup_develop $ZAQAR_DIR -e
setup_develop $ZAQAR_DIR
}
# install_zaqarclient() - Collect source and prepare
function install_zaqarclient {
git_clone $ZAQARCLIENT_REPO $ZAQARCLIENT_DIR $ZAQARCLIENT_BRANCH
setup_develop $ZAQARCLIENT_DIR
# NOTE(flaper87): Ideally, this should be develop but apparently
# there's a bug in devstack that skips test-requirements when using
# setup_develop
setup_install $ZAQARCLIENT_DIR
}
# start_zaqar() - Start running processes, including screen
function start_zaqar {
run_process zaqar-wsgi "uwsgi --master --ini $ZAQAR_UWSGI_CONF"
run_process zaqar-wsgi "uwsgi --ini $ZAQAR_UWSGI_CONF"
run_process zaqar-websocket "zaqar-server --config-file $ZAQAR_CONF"
echo "Waiting for Zaqar to start..."