fullstack: use migration scripts to create db schema

Previously, we used create_all() based on models. We don't use
create_all() in production code and there is no guarantee models and
scripts are in sync even though we have a good functional test that
validates that. There are still pieces that can't be compared by
alembic.

Change-Id: I72fa67811f0763298416e6e084a8b9b86619795b
Closes-Bug: 1486528
changes/13/215213/1
Jakub Libosvar 8 years ago
parent e2406d9e8c
commit 99fd239ba6

@ -15,8 +15,7 @@
from oslo_config import cfg
from oslo_db.sqlalchemy import test_base
from neutron.db.migration.models import head # noqa
from neutron.db import model_base
from neutron.db.migration import cli as migration
from neutron.tests.common import base
from neutron.tests.fullstack.resources import client as client_resource
@ -62,11 +61,13 @@ class BaseFullStackTestCase(base.MySQLTestCase):
'password': test_base.DbFixture.PASSWORD,
'db_name': self.engine.url.database})
alembic_config = migration.get_neutron_config()
alembic_config.neutron_config = cfg.CONF
self.original_conn = cfg.CONF.database.connection
self.addCleanup(self._revert_connection_address)
cfg.CONF.set_override('connection', conn, group='database')
model_base.BASEV2.metadata.create_all(self.engine)
migration.do_alembic_command(alembic_config, 'upgrade', 'heads')
def _revert_connection_address(self):
cfg.CONF.set_override('connection',

Loading…
Cancel
Save