summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-20 15:13:12 +0000
committerGerrit Code Review <review@openstack.org>2017-03-20 15:13:13 +0000
commitc45713ead3ced90ba9fbc1d67e4db60b8b80dae8 (patch)
tree6c80e27c111388cc1a78173f36acfb9aca268552
parent847e9a81b944bab5642fbcda496526d080d697a7 (diff)
parenta8ac320d8f3f386ce6e29dd3207c92db9e17ddf7 (diff)
Merge "add tests for alembic migration"
-rw-r--r--nailgun/nailgun/test/unit/test_migration_fuel_10_0.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/nailgun/nailgun/test/unit/test_migration_fuel_10_0.py b/nailgun/nailgun/test/unit/test_migration_fuel_10_0.py
index 5db483f..750e745 100644
--- a/nailgun/nailgun/test/unit/test_migration_fuel_10_0.py
+++ b/nailgun/nailgun/test/unit/test_migration_fuel_10_0.py
@@ -102,6 +102,7 @@ def prepare():
102 meta.tables['releases'].insert(), 102 meta.tables['releases'].insert(),
103 [{ 103 [{
104 'name': 'test_name', 104 'name': 'test_name',
105 'vmware_attributes_metadata': 'test_meta',
105 'version': '2015.1-10.0', 106 'version': '2015.1-10.0',
106 'operating_system': 'ubuntu', 107 'operating_system': 'ubuntu',
107 'state': 'available', 108 'state': 'available',
@@ -187,6 +188,7 @@ def prepare():
187 'timestamp': datetime.datetime.utcnow(), 188 'timestamp': datetime.datetime.utcnow(),
188 }] 189 }]
189 ) 190 )
191 node_id = result.inserted_primary_key[0]
190 192
191 result = db.execute( 193 result = db.execute(
192 meta.tables['plugins'].insert(), 194 meta.tables['plugins'].insert(),
@@ -324,6 +326,28 @@ def prepare():
324 ] 326 ]
325 ) 327 )
326 328
329 db.execute(
330 meta.tables['cluster_changes'].insert(),
331 [
332 {
333 'cluster_id': cluster_ids[0],
334 'node_id': node_id,
335 'name': 'networks',
336 'vmware_attributes': 'vmware_attributes'
337 }
338 ]
339 )
340
341 db.execute(
342 meta.tables['vmware_attributes'].insert(),
343 [
344 {
345 'cluster_id': cluster_ids[0],
346 'editable': 'test_data'
347 }
348 ]
349 )
350
327 TestRequiredComponentTypesField.prepare(meta) 351 TestRequiredComponentTypesField.prepare(meta)
328 db.commit() 352 db.commit()
329 353
@@ -389,3 +413,22 @@ class TestRequiredComponentTypesField(base.BaseAlembicMigrationTest):
389 'required_component_types': None 413 'required_component_types': None
390 }) 414 })
391 db.rollback() 415 db.rollback()
416
417
418class TestRemoveVMware(base.BaseAlembicMigrationTest):
419 def test_vmware_attributes_metadata_not_exist_in_releases(self):
420 releases_table = self.meta.tables['releases']
421 self.assertNotIn('vmware_attributes_metadata', releases_table.c)
422
423 def test_there_is_no_table_vmware_attributes(self):
424 self.assertNotIn('vmware_attributes', self.meta.tables)
425
426 def test_vmware_attributes_not_exist_in_cluster_changes(self):
427 cluster_changes_table = self.meta.tables['cluster_changes']
428 self.assertNotIn('vmware_attributes', cluster_changes_table.c)
429
430 def test_cluster_changes_enum_doesnt_have_old_values(self):
431 result = db.execute(sa.text(
432 'select unnest(enum_range(NULL::possible_changes))'
433 )).fetchall()
434 self.assertNotIn('vmware_attributes', [x[0] for x in result])