Add pre and check phases to test migration 005
Migration 005 changes size collumn from integer to BigInteger. This checks if everything goes fine in the migration. Change-Id: Ia4f12e3d43d7fcc31dc999bc1ad5dcd0610df597
This commit is contained in:
committed by
Gerrit Code Review
parent
456a8c83e1
commit
bb309a85e4
@@ -449,6 +449,31 @@ class TestMigrations(utils.BaseTestCase):
|
||||
self.assertIn('checksum', images.c)
|
||||
self.assertEquals(images.c['checksum'].type.length, 32)
|
||||
|
||||
def _prerun_005(self, engine):
|
||||
now = timeutils.utcnow()
|
||||
images = get_table(engine, 'images')
|
||||
data = [
|
||||
{
|
||||
'deleted': False, 'created_at': now, 'updated_at': now,
|
||||
'type': 'kernel', 'status': 'active', 'is_public': True,
|
||||
# Integer type signed size limit
|
||||
'size': 2147483647
|
||||
}
|
||||
]
|
||||
engine.execute(images.insert(), data)
|
||||
return data
|
||||
|
||||
def _check_005(self, engine, data):
|
||||
|
||||
images = get_table(engine, 'images')
|
||||
select = images.select().execute()
|
||||
|
||||
sizes = [row['size'] for row in select if row['size'] is not None]
|
||||
migrated_data_sizes = [element['size'] for element in data]
|
||||
|
||||
for migrated in migrated_data_sizes:
|
||||
self.assertIn(migrated, sizes)
|
||||
|
||||
def _prerun_015(self, engine):
|
||||
images = get_table(engine, 'images')
|
||||
unquoted_locations = [
|
||||
|
||||
Reference in New Issue
Block a user