Fixing UT issues to support Python 3 Train Version

Change-Id: I5b779f093a465812dbca745ce4b226370b6a6bd5
This commit is contained in:
VedaAnnayappa 2019-08-26 02:12:21 -04:00 committed by VedaAnnayappa
parent 5de7a5ebdc
commit 49a618b893
8 changed files with 40 additions and 9 deletions

View File

@ -3,5 +3,5 @@
- check-requirements
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python36-jobs
- openstack-python3-train-jobs
- periodic-stable-jobs

View File

@ -130,7 +130,7 @@ PyNaCl==1.2.1
pyOpenSSL==17.5.0
pyparsing==2.2.0
pyperclip==1.6.0
pypowervm==1.1.20
pypowervm==1.1.23
pytest==3.4.2
python-barbicanclient==4.5.2
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',
'fake_lpar', admin_pass='pass')
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',
admin_pass='pass')
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)
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.
self.vol_drv.connection_info['data'].pop('auth_method')
mock_discover.return_value = '/dev/fake', 'fake_udid2'
@ -263,7 +292,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
mock_active_vioses.return_value = [mock_vios]
self.vol_drv.extend_volume()
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(
operation_name='RescanVirtualDisk', error='fake_err')
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()
self.assertEqual(0, mock_remove_maps.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)
# Ensures that if UDID not found, then mappings are not
@ -586,7 +615,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
volume_key = 'vscsi-' + self.serial
mig_vol_stor = {volume_key: 'udid'}
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):

View File

@ -118,7 +118,7 @@ class TestNPIVAdapter(test_vol.TestVolumeAdapter):
self.assertEqual(1, mock_add_map.call_count)
mock_add_map.assert_called_once_with(
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(npiv.FS_INST_MAPPED,
self.vol_drv._get_fabric_state('A'))

View File

@ -9,7 +9,8 @@ oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.21.1 # Apache-2.0
oslo.utils>=3.37.0 # Apache-2.0
os-resource-classes>=0.1.0 # Apache-2.0
pypowervm>=1.1.20 # Apache-2.0
psycopg2-binary>=2.8.3
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.1.0,>=1.6.2;python_version>='3.4' # BSD
python-swiftclient>=3.2.0 # Apache-2.0

View File

@ -16,6 +16,7 @@ classifier =
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[files]
packages =

View File

@ -1,6 +1,6 @@
[tox]
minversion = 3.1.1
envlist = py36,py27,pep8
envlist = py27,py36,py37,pep8
skipsdist = True
# Automatic envs (pyXX) will use the python version appropriate to that
# env and ignore basepython inherited from [testenv]. That's what we