======================
-Testing database and models sync
---------------------------------
+Tests to verify that database migrations and models are in sync
+---------------------------------------------------------------
-.. automodule:: neutron.tests.unit.db.test_migration
+.. automodule:: neutron.tests.functional.db.test_migration
.. autoclass:: _TestModelsMigrations
:members:
FUNC_FILTER=$BASE/new/neutron/neutron/tests/functional/contrib/filters.template
sed -e "s+\$BASE_PATH+$BASE/new/neutron/.tox/dsvm-functional+" \
$FUNC_FILTER | sudo tee /etc/neutron/rootwrap.d/functional.filters > /dev/null
+
+# Use devstack functions to install mysql and psql servers
+TOP_DIR=$BASE/new/devstack
+source $TOP_DIR/functions
+source $TOP_DIR/lib/config
+source $TOP_DIR/stackrc
+source $TOP_DIR/lib/database
+source $TOP_DIR/localrc
+
+disable_service postgresql
+enable_service mysql
+initialize_database_backends
+install_database
+
+disable_service mysql
+enable_service postgresql
+initialize_database_backends
+install_database
+
+# Set up the 'openstack_citest' user and database in each backend
+tmp_dir=`mktemp -d`
+
+cat << EOF > $tmp_dir/mysql.sql
+CREATE DATABASE openstack_citest;
+CREATE USER 'openstack_citest'@'localhost' IDENTIFIED BY 'openstack_citest';
+CREATE USER 'openstack_citest' IDENTIFIED BY 'openstack_citest';
+GRANT ALL PRIVILEGES ON *.* TO 'openstack_citest'@'localhost';
+GRANT ALL PRIVILEGES ON *.* TO 'openstack_citest';
+FLUSH PRIVILEGES;
+EOF
+/usr/bin/mysql -u root < $tmp_dir/mysql.sql
+
+cat << EOF > $tmp_dir/postgresql.sql
+CREATE USER openstack_citest WITH CREATEDB LOGIN PASSWORD 'openstack_citest';
+CREATE DATABASE openstack_citest WITH OWNER openstack_citest;
+EOF
+# User/group postgres needs to be given access to tmp_dir
+setfacl -m g:postgres:rwx $tmp_dir
+sudo -u postgres /usr/bin/psql --file=$tmp_dir/postgresql.sql
--- /dev/null
+# Additional requirements for functional tests
+
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+
+psycopg2
+MySQL-python
[testenv:functional]
setenv = OS_TEST_PATH=./neutron/tests/functional
OS_TEST_TIMEOUT=90
+deps =
+ {[testenv]deps}
+ -r{toxinidir}/neutron/tests/functional/requirements.txt
[testenv:dsvm-functional]
setenv = OS_TEST_PATH=./neutron/tests/functional
OS_FAIL_ON_MISSING_DEPS=1
OS_TEST_TIMEOUT=90
sitepackages=True
+deps =
+ {[testenv:functional]deps}
[tox:jenkins]
sitepackages = True