"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/db/test_migrations.py" between
cinder-12.0.9.tar.gz and cinder-12.0.10.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Queens" series (maintained release).

test_migrations.py  (cinder-12.0.9):test_migrations.py  (cinder-12.0.10)
skipping to change at line 37 skipping to change at line 37
from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import test_fixtures from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import test_migrations from oslo_db.sqlalchemy import test_migrations
from oslo_db.sqlalchemy import utils as db_utils from oslo_db.sqlalchemy import utils as db_utils
from oslotest import base as test_base from oslotest import base as test_base
import sqlalchemy import sqlalchemy
from sqlalchemy.engine import reflection from sqlalchemy.engine import reflection
from cinder.db import migration from cinder.db import migration
import cinder.db.sqlalchemy.migrate_repo import cinder.db.sqlalchemy.migrate_repo
from cinder.tests.unit import utils as test_utils
from cinder.volume import group_types as volume_group_types from cinder.volume import group_types as volume_group_types
class MigrationsMixin(test_migrations.WalkVersionsMixin): class MigrationsMixin(test_migrations.WalkVersionsMixin):
"""Test sqlalchemy-migrate migrations.""" """Test sqlalchemy-migrate migrations."""
BOOL_TYPE = sqlalchemy.types.BOOLEAN BOOL_TYPE = sqlalchemy.types.BOOLEAN
TIME_TYPE = sqlalchemy.types.DATETIME TIME_TYPE = sqlalchemy.types.DATETIME
INTEGER_TYPE = sqlalchemy.types.INTEGER INTEGER_TYPE = sqlalchemy.types.INTEGER
VARCHAR_TYPE = sqlalchemy.types.VARCHAR VARCHAR_TYPE = sqlalchemy.types.VARCHAR
TEXT_TYPE = sqlalchemy.types.Text TEXT_TYPE = sqlalchemy.types.Text
skipping to change at line 407 skipping to change at line 408
def _check_115(self, engine, data): def _check_115(self, engine, data):
volumes = db_utils.get_table(engine, 'volumes') volumes = db_utils.get_table(engine, 'volumes')
self.assertIsInstance(volumes.c.shared_targets.type, self.assertIsInstance(volumes.c.shared_targets.type,
self.BOOL_TYPE) self.BOOL_TYPE)
def _check_116(self, engine, data): def _check_116(self, engine, data):
volume_attachment = db_utils.get_table(engine, 'volume_attachment') volume_attachment = db_utils.get_table(engine, 'volume_attachment')
self.assertIn('connector', volume_attachment.c) self.assertIn('connector', volume_attachment.c)
# NOTE: this test becomes slower with each addition of new DB migration.
# 'pymysql' works much slower on slow nodes than 'psycopg2'. And such
# timeout mostly required for testing of 'mysql' backend.
@test_utils.set_timeout(300)
def test_walk_versions(self): def test_walk_versions(self):
self.walk_versions(False, False) self.walk_versions(False, False)
self.assert_each_foreign_key_is_part_of_an_index() self.assert_each_foreign_key_is_part_of_an_index()
class TestSqliteMigrations(test_fixtures.OpportunisticDBTestMixin, class TestSqliteMigrations(test_fixtures.OpportunisticDBTestMixin,
MigrationsMixin, MigrationsMixin,
test_base.BaseTestCase): test_base.BaseTestCase):
def assert_each_foreign_key_is_part_of_an_index(self): def assert_each_foreign_key_is_part_of_an_index(self):
# Skip the test for SQLite because SQLite does not list # Skip the test for SQLite because SQLite does not list
skipping to change at line 428 skipping to change at line 433
# Given that SQLite is only for testing purposes, it is safe to skip # Given that SQLite is only for testing purposes, it is safe to skip
pass pass
class TestMysqlMigrations(test_fixtures.OpportunisticDBTestMixin, class TestMysqlMigrations(test_fixtures.OpportunisticDBTestMixin,
MigrationsMixin, MigrationsMixin,
test_base.BaseTestCase): test_base.BaseTestCase):
FIXTURE = test_fixtures.MySQLOpportunisticFixture FIXTURE = test_fixtures.MySQLOpportunisticFixture
BOOL_TYPE = sqlalchemy.dialects.mysql.TINYINT BOOL_TYPE = sqlalchemy.dialects.mysql.TINYINT
@test_utils.set_timeout(300)
def test_mysql_innodb(self): def test_mysql_innodb(self):
"""Test that table creation on mysql only builds InnoDB tables.""" """Test that table creation on mysql only builds InnoDB tables."""
# add this to the global lists to make reset work with it, it's removed # add this to the global lists to make reset work with it, it's removed
# automatically in tearDown so no need to clean it up here. # automatically in tearDown so no need to clean it up here.
# sanity check # sanity check
migration.db_sync(engine=self.migrate_engine) migration.db_sync(engine=self.migrate_engine)
total = self.migrate_engine.execute( total = self.migrate_engine.execute(
"SELECT count(*) " "SELECT count(*) "
"from information_schema.TABLES " "from information_schema.TABLES "
 End of changes. 3 change blocks. 
0 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)