Browse Source

[VNX] Fix test case issue

Major changes:
1. Fix mock file issue
2. Fix cg test case issue

Change-Id: Ia95936f3cea611f9fb7517d3b6849f511be2450b
Closes-bug: #1795957
(cherry picked from commit 18fbbd1afe)
(cherry picked from commit 053c33cbfc)
(cherry picked from commit 4fd1cdcf62)
tags/12.0.8^0
Yong Huang 4 months ago
parent
commit
f55d3a6f61

+ 9
- 4
cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml View File

@@ -355,7 +355,7 @@ test_migrate_lun_error:
355 355
 
356 356
 test_verify_migration:
357 357
   lun1: &src_lun
358
-    _propertis:
358
+    _properties:
359 359
       <<: *lun_base_prop
360 360
   lun2: &dst_lun
361 361
     _properties:
@@ -1641,10 +1641,13 @@ test_do_create_cg_from_cgsnap:
1641 1641
       lun_id: 12
1642 1642
     _methods:
1643 1643
       attach_snap:
1644
-
1645 1644
   lun: &src_lun_in_cg
1646 1645
     _methods:
1647 1646
       create_mount_point: *smp_from_src_lun
1647
+  lun2: &new_lun
1648
+    _properties:
1649
+      poll: false
1650
+      wwn: 'new_wwn'
1648 1651
   vnx:
1649 1652
     _properties:
1650 1653
     _methods:
@@ -1653,7 +1656,8 @@ test_do_create_cg_from_cgsnap:
1653 1656
         *snapshot_test_delete_snapshot]
1654 1657
       get_lun:
1655 1658
         _side_effect: [*src_lun_in_cg, *smp_from_src_lun,
1656
-        *smp_from_src_lun, *lun_migrate, *src_lun, *dst_lun]
1659
+        *smp_from_src_lun, *new_lun, *lun_migrate,
1660
+        *src_lun, *new_lun]
1657 1661
       get_pool: *pool_test_create_lun
1658 1662
       get_migration_session: *session_verify
1659 1663
       create_cg: *cg_for_create
@@ -1666,7 +1670,8 @@ test_do_clone_cg:
1666 1670
       get_snap: *snapshot_test_delete_snapshot
1667 1671
       get_lun:
1668 1672
         _side_effect: [*src_lun_in_cg, *smp_from_src_lun,
1669
-        *smp_from_src_lun, *lun_migrate, *src_lun, *dst_lun]
1673
+        *smp_from_src_lun, *new_lun, *lun_migrate,
1674
+        *src_lun, *new_lun]
1670 1675
       get_pool: *pool_test_create_lun
1671 1676
       get_migration_session: *session_verify
1672 1677
       create_cg: *cg_for_create

+ 6
- 6
cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py View File

@@ -218,9 +218,9 @@ class TestCommonAdapter(test.TestCase):
218 218
             vnx_common.do_create_cg_from_cgsnap(
219 219
                 cg_id, cg_host, volumes, cgsnap_id, snaps))
220 220
         self.assertIsNone(model_update)
221
-        self.assertIsNotNone(
222
-            re.findall('id^12',
223
-                       volume_updates[0]['provider_location']))
221
+        provider_location = re.findall('id\^12',
222
+                                       volume_updates[0]['provider_location'])
223
+        self.assertEqual(1, len(provider_location))
224 224
 
225 225
     @res_mock.patch_common_adapter
226 226
     def test_create_cloned_cg(self, common, _):
@@ -277,9 +277,9 @@ class TestCommonAdapter(test.TestCase):
277 277
         model_update, volume_updates = vnx_common.do_clone_cg(
278 278
             cg_id, cg_host, volumes, src_cg_id, src_volumes)
279 279
         self.assertIsNone(model_update)
280
-        self.assertIsNotNone(
281
-            re.findall('id^12',
282
-                       volume_updates[0]['provider_location']))
280
+        provider_location = re.findall('id\^12',
281
+                                       volume_updates[0]['provider_location'])
282
+        self.assertEqual(1, len(provider_location))
283 283
 
284 284
     @res_mock.patch_common_adapter
285 285
     def test_parse_pools(self, vnx_common, mocked):

Loading…
Cancel
Save