DB migration tests
Refactored migration tests to use OpportunisticTestCase, removed unused code and ``test_migrations.conf`` file. The main feature of this approach is to create a new database with random name for each migration test. This will avoid migration tests of race conditions and reduce tests intersection. After this change, database ``openstack_citest`` will be used only for initial connection to the database. ``test_migrations.conf`` file not required anymore, because we create test database for migration test, so we no longer need to keep database credentials. Implements blueprint: db-migration-tests Related-bug: #1266595 Change-Id: I4febd485ff53936b636947c86773a23724e24c65
This commit is contained in:
committed by
Ivan Kolodyazhny
parent
5259bd7f60
commit
9b94302d7b
@@ -62,6 +62,7 @@ import warnings
|
||||
warnings.simplefilter('once', DeprecationWarning)
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db.sqlalchemy import migration
|
||||
from oslo import messaging
|
||||
|
||||
from cinder import i18n
|
||||
@@ -71,7 +72,8 @@ i18n.enable_lazy()
|
||||
from cinder.common import config # noqa
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder.db import migration
|
||||
from cinder.db import migration as db_migration
|
||||
from cinder.db.sqlalchemy import api as db_api
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import uuidutils
|
||||
@@ -218,11 +220,13 @@ class DbCommands(object):
|
||||
help='Database version')
|
||||
def sync(self, version=None):
|
||||
"""Sync the database up to the most recent version."""
|
||||
return migration.db_sync(version)
|
||||
return db_migration.db_sync(version)
|
||||
|
||||
def version(self):
|
||||
"""Print the current database version."""
|
||||
print(migration.db_version())
|
||||
print(migration.db_version(db_api.get_engine(),
|
||||
db_migration.MIGRATE_REPO_PATH,
|
||||
db_migration.INIT_VERSION))
|
||||
|
||||
|
||||
class VersionCommands(object):
|
||||
|
||||
Reference in New Issue
Block a user