Merge "Add linuxscsi get_device_info unit test"
This commit is contained in:
commit
d5de32b9b6
|
@ -848,6 +848,21 @@ loop0 0"""
|
||||||
mock_exec.assert_called_once_with(
|
mock_exec.assert_called_once_with(
|
||||||
'multipathd', 'show', 'status', run_as_root=True, root_helper=None)
|
'multipathd', 'show', 'status', run_as_root=True, root_helper=None)
|
||||||
|
|
||||||
|
def test_get_device_info(self):
|
||||||
|
ret = "/dev/sg0 scsi1 channel=1 id=0 lun=0 [em]\n"
|
||||||
|
with mock.patch.object(self.linuxscsi, '_execute') as exec_mock:
|
||||||
|
exec_mock.return_value = (ret, "")
|
||||||
|
info = self.linuxscsi.get_device_info('/dev/adevice')
|
||||||
|
|
||||||
|
exec_mock.assert_called_once_with('sg_scan', '/dev/adevice',
|
||||||
|
root_helper=None,
|
||||||
|
run_as_root=True)
|
||||||
|
self.assertEqual(info, {'channel': '1',
|
||||||
|
'device': '/dev/adevice',
|
||||||
|
'host': '1',
|
||||||
|
'id': '0',
|
||||||
|
'lun': '0'})
|
||||||
|
|
||||||
@mock.patch('glob.glob')
|
@mock.patch('glob.glob')
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwid')
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwid')
|
||||||
def test_get_sysfs_wwn_single_designator(self, get_wwid_mock, glob_mock):
|
def test_get_sysfs_wwn_single_designator(self, get_wwid_mock, glob_mock):
|
||||||
|
|
Loading…
Reference in New Issue