summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gajsin <igajsin@mirantis.com>2017-02-27 15:32:27 +0300
committerIgor Gajsin <igajsin@mirantis.com>2017-03-13 14:02:23 +0300
commita8ac320d8f3f386ce6e29dd3207c92db9e17ddf7 (patch)
tree2c0fe2a6a1ba9c7fe474fd8ac56d922d9a055d50
parent9fc3e312dc15e0bfab9c3148f277a3b74b2496c7 (diff)
add tests for alembic migration
There was the commit that removes vmware. It has alembic migrations, but doesn't have any tests for that. This commit fixes that. Change-Id: I66090b0a0d7bfbd8e2365ec027fabfefc9d612da Closes-Bug: #1668249
Notes
Notes (review): Code-Review+2: Aleksey Kasatkin <akasatkin@mirantis.com> Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Alexander Kislitsky <akislitsky@mirantis.com> Workflow+1: Alexander Kislitsky <akislitsky@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 20 Mar 2017 15:13:12 +0000 Reviewed-on: https://review.openstack.org/438473 Project: openstack/fuel-web Branch: refs/heads/master
-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])