Browse Source

Merge "add tests for alembic migration"

Jenkins 2 years ago
parent
commit
c45713ead3
1 changed files with 43 additions and 0 deletions
  1. 43
    0
      nailgun/nailgun/test/unit/test_migration_fuel_10_0.py

+ 43
- 0
nailgun/nailgun/test/unit/test_migration_fuel_10_0.py View File

@@ -102,6 +102,7 @@ def prepare():
102 102
         meta.tables['releases'].insert(),
103 103
         [{
104 104
             'name': 'test_name',
105
+            'vmware_attributes_metadata': 'test_meta',
105 106
             'version': '2015.1-10.0',
106 107
             'operating_system': 'ubuntu',
107 108
             'state': 'available',
@@ -187,6 +188,7 @@ def prepare():
187 188
             'timestamp': datetime.datetime.utcnow(),
188 189
         }]
189 190
     )
191
+    node_id = result.inserted_primary_key[0]
190 192
 
191 193
     result = db.execute(
192 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 351
     TestRequiredComponentTypesField.prepare(meta)
328 352
     db.commit()
329 353
 
@@ -389,3 +413,22 @@ class TestRequiredComponentTypesField(base.BaseAlembicMigrationTest):
389 413
                     'required_component_types': None
390 414
                 })
391 415
         db.rollback()
416
+
417
+
418
+class 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])

Loading…
Cancel
Save