Fixing Unit Test Issues

Updating to 1.1.23 version of pypowervm and Fixing UT issues accordingly

Change-Id: I7291077407c818c712fb5c98952a15020191a2cc
This commit is contained in:
VedaAnnayappa 2019-10-07 07:09:39 -04:00 committed by VedaAnnayappa
parent 5de7a5ebdc
commit 1fe310f4be
5 changed files with 38 additions and 8 deletions

View File

@ -114,7 +114,8 @@ pluggy==0.6.0
ply==3.11 ply==3.11
prettytable==0.7.1 prettytable==0.7.1
psutil==3.2.2 psutil==3.2.2
psycopg2==2.7 libpq-dev==9.0.0
psycopg2==2.8.3
py==1.5.2 py==1.5.2
pyasn1==0.4.2 pyasn1==0.4.2
pyasn1-modules==0.2.1 pyasn1-modules==0.2.1
@ -130,7 +131,7 @@ PyNaCl==1.2.1
pyOpenSSL==17.5.0 pyOpenSSL==17.5.0
pyparsing==2.2.0 pyparsing==2.2.0
pyperclip==1.6.0 pyperclip==1.6.0
pypowervm==1.1.20 pypowervm==1.1.23
pytest==3.4.2 pytest==3.4.2
python-barbicanclient==4.5.2 python-barbicanclient==4.5.2
python-cinderclient==3.3.0 python-cinderclient==3.3.0

View File

@ -103,7 +103,7 @@ class TestConfigDrivePowerVM(test.NoDBTestCase):
cfg_dr_builder.create_cfg_drv_vopt(mock_instance, 'files', 'netinfo', cfg_dr_builder.create_cfg_drv_vopt(mock_instance, 'files', 'netinfo',
'fake_lpar', admin_pass='pass') 'fake_lpar', admin_pass='pass')
mock_ntf.assert_called_once_with(mode='rb') mock_ntf.assert_called_once_with(mode='rb')
mock_ccdi.assert_called_once_with(cfg_dr_builder, mock_instance, mock_ccdi.assert_called_once_with(mock_instance,
'files', 'netinfo', 'iso_path', 'files', 'netinfo', 'iso_path',
admin_pass='pass') admin_pass='pass')
mock_getsize.assert_called_once_with('iso_path') mock_getsize.assert_called_once_with('iso_path')

View File

@ -181,6 +181,35 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
self.multi_vol_drv.connect_volume(self.slot_mgr) self.multi_vol_drv.connect_volume(self.slot_mgr)
mock_discover.assert_has_calls(multi_calls, any_order=True) mock_discover.assert_has_calls(multi_calls, any_order=True)
@mock.patch('nova_powervm.virt.powervm.volume.vscsi.PVVscsiFCVolumeAdapter'
'._validate_vios_on_connection', new=mock.Mock())
@mock.patch('pypowervm.tasks.hdisk.discover_iscsi', autospec=True)
@mock.patch('pypowervm.tasks.scsi_mapper.add_map', autospec=True)
@mock.patch('pypowervm.tasks.scsi_mapper.build_vscsi_mapping',
autospec=True)
@mock.patch('pypowervm.tasks.hdisk.lua_recovery', autospec=True)
@mock.patch('nova_powervm.virt.powervm.vm.get_vm_id')
def test_connect_volume_noauth(self, mock_get_vm_id, mock_lua_recovery,
mock_build_map,
mock_add_map, mock_discover):
# The mock return values
mock_lua_recovery.return_value = (
hdisk.LUAStatus.DEVICE_AVAILABLE, 'devname', 'udid')
mock_get_vm_id.return_value = '2'
mock_discover.return_value = '/dev/fake', 'fake_udid'
def build_map_func(host_uuid, vios_w, lpar_uuid, pv,
lpar_slot_num=None, lua=None, target_name=None):
self.assertEqual('host_uuid', host_uuid)
self.assertIsInstance(vios_w, pvm_vios.VIOS)
self.assertEqual('1234', lpar_uuid)
self.assertIsInstance(pv, pvm_stor.PV)
self.assertEqual('_volume_id', pv.tag[1:])
self.assertEqual(62, lpar_slot_num)
self.assertEqual('the_lua', lua)
return 'fake_map'
mock_build_map.side_effect = build_map_func
# connect without using CHAP authentication. # connect without using CHAP authentication.
self.vol_drv.connection_info['data'].pop('auth_method') self.vol_drv.connection_info['data'].pop('auth_method')
mock_discover.return_value = '/dev/fake', 'fake_udid2' mock_discover.return_value = '/dev/fake', 'fake_udid2'
@ -263,7 +292,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
mock_active_vioses.return_value = [mock_vios] mock_active_vioses.return_value = [mock_vios]
self.vol_drv.extend_volume() self.vol_drv.extend_volume()
mock_rescan.assert_called_once_with(self.vol_drv.vios_uuids[0], mock_rescan.assert_called_once_with(self.vol_drv.vios_uuids[0],
"vstor_uuid", self.adpt) "vstor_uuid", adapter=self.adpt)
mock_rescan.side_effect = pvm_exc.JobRequestFailed( mock_rescan.side_effect = pvm_exc.JobRequestFailed(
operation_name='RescanVirtualDisk', error='fake_err') operation_name='RescanVirtualDisk', error='fake_err')
self.assertRaises(p_exc.VolumeExtendFailed, self.vol_drv.extend_volume) self.assertRaises(p_exc.VolumeExtendFailed, self.vol_drv.extend_volume)
@ -401,7 +430,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
# mock_remove_maps.assert_not_called() # mock_remove_maps.assert_not_called()
self.assertEqual(0, mock_remove_maps.call_count) self.assertEqual(0, mock_remove_maps.call_count)
self.assertEqual(0, mock_remove_iscsi.call_count) self.assertEqual(0, mock_remove_iscsi.call_count)
mock_hdisk_from_uuid.assert_called_with(mock.ANY, 'vstor_uuid') mock_hdisk_from_uuid.assert_called_with('vstor_uuid')
self.assertFalse(status) self.assertFalse(status)
# Ensures that if UDID not found, then mappings are not # Ensures that if UDID not found, then mappings are not
@ -586,7 +615,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
volume_key = 'vscsi-' + self.serial volume_key = 'vscsi-' + self.serial
mig_vol_stor = {volume_key: 'udid'} mig_vol_stor = {volume_key: 'udid'}
self.vol_drv.post_live_migration_at_destination(mig_vol_stor) self.vol_drv.post_live_migration_at_destination(mig_vol_stor)
mock_set_udid.assert_called_with(mock.ANY, 'udid') mock_set_udid.assert_called_with('udid')
def test_post_live_migr_source(self): def test_post_live_migr_source(self):

View File

@ -118,7 +118,7 @@ class TestNPIVAdapter(test_vol.TestVolumeAdapter):
self.assertEqual(1, mock_add_map.call_count) self.assertEqual(1, mock_add_map.call_count)
mock_add_map.assert_called_once_with( mock_add_map.assert_called_once_with(
mock.ANY, 'host_uuid', '1234', ('21000024FF649104', 'AA BB'), mock.ANY, 'host_uuid', '1234', ('21000024FF649104', 'AA BB'),
lpar_slot_num='62', provided={}) lpar_slot_num='62')
self.assertEqual(1, self.ft_fx.patchers['update'].mock.call_count) self.assertEqual(1, self.ft_fx.patchers['update'].mock.call_count)
self.assertEqual(npiv.FS_INST_MAPPED, self.assertEqual(npiv.FS_INST_MAPPED,
self.vol_drv._get_fabric_state('A')) self.vol_drv._get_fabric_state('A'))

View File

@ -9,7 +9,7 @@ oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.21.1 # Apache-2.0 oslo.serialization!=2.19.1,>=2.21.1 # Apache-2.0
oslo.utils>=3.37.0 # Apache-2.0 oslo.utils>=3.37.0 # Apache-2.0
os-resource-classes>=0.1.0 # Apache-2.0 os-resource-classes>=0.1.0 # Apache-2.0
pypowervm>=1.1.20 # Apache-2.0 pypowervm>=1.1.23 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
python-swiftclient>=3.2.0 # Apache-2.0 python-swiftclient>=3.2.0 # Apache-2.0