Merge "Fix experimental E-M-C migrations"
This commit is contained in:
commit
30148b2be9
@ -40,7 +40,7 @@ def has_migrations(engine):
|
||||
return True
|
||||
|
||||
image_members = Table('image_members', meta, autoload=True)
|
||||
rows_with_pending_shared = (select[images.c.id]
|
||||
rows_with_pending_shared = (select([images.c.id])
|
||||
.where(and_(
|
||||
images.c.visibility == 'private',
|
||||
images.c.id.in_(
|
||||
|
@ -27,7 +27,7 @@ from glance.db import migration
|
||||
revision = 'ocata_contract01'
|
||||
down_revision = 'mitaka02'
|
||||
branch_labels = migration.CONTRACT_BRANCH
|
||||
depends_on = 'expand'
|
||||
depends_on = 'ocata_expand01'
|
||||
|
||||
|
||||
MYSQL_DROP_INSERT_TRIGGER = """
|
||||
|
@ -145,3 +145,35 @@ class TestOcataMigrate01Mixin(test_migrations.AlembicMigrationsMixin):
|
||||
class TestOcataMigrate01MySQL(TestOcataMigrate01Mixin,
|
||||
test_base.MySQLOpportunisticTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class TestOcataMigrate01_EmptyDBMixin(test_migrations.AlembicMigrationsMixin):
|
||||
"""This mixin is used to create an initial glance database and upgrade it
|
||||
up to the ocata_expand01 revision.
|
||||
"""
|
||||
def _get_revisions(self, config):
|
||||
return test_migrations.AlembicMigrationsMixin._get_revisions(
|
||||
self, config, head='ocata_expand01')
|
||||
|
||||
def _pre_upgrade_ocata_expand01(self, engine):
|
||||
# New/empty database
|
||||
pass
|
||||
|
||||
def _check_ocata_expand01(self, engine, data):
|
||||
images = db_utils.get_table(engine, 'images')
|
||||
|
||||
# check that there are no rows in the images table
|
||||
rows = (images.select()
|
||||
.order_by(images.c.id)
|
||||
.execute()
|
||||
.fetchall())
|
||||
self.assertEqual(0, len(rows))
|
||||
|
||||
# run data migrations
|
||||
data_migrations.migrate(engine)
|
||||
|
||||
|
||||
class TestOcataMigrate01_EmptyDBMySQL(TestOcataMigrate01_EmptyDBMixin,
|
||||
test_base.MySQLOpportunisticTestCase):
|
||||
"""This test runs the Ocata data migrations on an empty databse."""
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user