From 9a1953a3bb78d85d6991b04ade68cb24e0c091b3 Mon Sep 17 00:00:00 2001 From: Yong Huang Date: Fri, 17 May 2019 10:03:46 +0800 Subject: [PATCH] [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 18fbbd1afe2b9151fe521d200b280ae4a0ef6202) (cherry picked from commit 053c33cbfc2b4b72d9ca20f617e542452f98944f) (cherry picked from commit 4fd1cdcf62bf83b57d7685d19fa06daa522c9a98) (cherry picked from commit f55d3a6f61b3be3df4597504d26385ddb72f6b6b) --- .../volume/drivers/dell_emc/vnx/mocked_vnx.yaml | 13 +++++++++---- .../volume/drivers/dell_emc/vnx/test_adapter.py | 12 ++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml index 3fdbac63ba8..7f6092a58a1 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml +++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml @@ -351,7 +351,7 @@ test_migrate_lun_error: test_verify_migration: lun1: &src_lun - _propertis: + _properties: <<: *lun_base_prop lun2: &dst_lun _properties: @@ -1636,10 +1636,13 @@ test_do_create_cg_from_cgsnap: lun_id: 12 _methods: attach_snap: - lun: &src_lun_in_cg _methods: create_mount_point: *smp_from_src_lun + lun2: &new_lun + _properties: + poll: false + wwn: 'new_wwn' vnx: _properties: _methods: @@ -1648,7 +1651,8 @@ test_do_create_cg_from_cgsnap: *snapshot_test_delete_snapshot] get_lun: _side_effect: [*src_lun_in_cg, *smp_from_src_lun, - *smp_from_src_lun, *lun_migrate, *src_lun, *dst_lun] + *smp_from_src_lun, *new_lun, *lun_migrate, + *src_lun, *new_lun] get_pool: *pool_test_create_lun get_migration_session: *session_verify create_cg: *cg_for_create @@ -1661,7 +1665,8 @@ test_do_clone_cg: get_snap: *snapshot_test_delete_snapshot get_lun: _side_effect: [*src_lun_in_cg, *smp_from_src_lun, - *smp_from_src_lun, *lun_migrate, *src_lun, *dst_lun] + *smp_from_src_lun, *new_lun, *lun_migrate, + *src_lun, *new_lun] get_pool: *pool_test_create_lun get_migration_session: *session_verify create_cg: *cg_for_create diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py index 5a4e2a12579..7bde14bcf07 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py @@ -221,9 +221,9 @@ class TestCommonAdapter(test.TestCase): vnx_common.do_create_cg_from_cgsnap( cg_id, cg_host, volumes, cgsnap_id, snaps)) self.assertIsNone(model_update) - self.assertIsNotNone( - re.findall('id^12', - volume_updates[0]['provider_location'])) + provider_location = re.findall('id\^12', + volume_updates[0]['provider_location']) + self.assertEqual(1, len(provider_location)) @res_mock.patch_common_adapter def test_create_cloned_cg(self, common, _): @@ -280,9 +280,9 @@ class TestCommonAdapter(test.TestCase): model_update, volume_updates = vnx_common.do_clone_cg( cg_id, cg_host, volumes, src_cg_id, src_volumes) self.assertIsNone(model_update) - self.assertIsNotNone( - re.findall('id^12', - volume_updates[0]['provider_location'])) + provider_location = re.findall('id\^12', + volume_updates[0]['provider_location']) + self.assertEqual(1, len(provider_location)) @res_mock.patch_common_adapter def test_parse_pools(self, vnx_common, mocked):