NetApp: Refactor E-Series tests

Refactor the unittests for the NetApp E-Series drivers, removing
any functional tests and relocating tests underneath the
the path where the rest of the tests live.

Improve the coverage against the Fibre Channel E-Series driver
by refactoring the iSCSI tests to work generically where possible.

Change-Id: I30082859242cb5bc8d607ea2a6684a41f863b611
This commit is contained in:
Michael Price
2015-11-02 13:06:36 -06:00
parent 55b6773c24
commit 3b9c900e9c
8 changed files with 562 additions and 1047 deletions

View File

@@ -148,6 +148,43 @@ class NetAppEseriesClientDriverTestCase(test.TestCase):
self.assertEqual(expected_wwpns, actual_wwpns)
def test_get_host_group_by_name(self):
groups = copy.deepcopy(eseries_fake.HOST_GROUPS)
group = groups[0]
self.mock_object(self.my_client, 'list_host_groups',
new_attr=mock.Mock(return_value=groups))
result = self.my_client.get_host_group_by_name(group['label'])
self.assertEqual(group, result)
def test_move_volume_mapping_via_symbol(self):
invoke = self.mock_object(self.my_client, '_invoke',
mock.Mock(return_value='ok'))
host_ref = 'host'
cluster_ref = 'cluster'
lun_id = 10
expected_data = {'lunMappingRef': host_ref, 'lun': lun_id,
'mapRef': cluster_ref}
result = self.my_client.move_volume_mapping_via_symbol(host_ref,
cluster_ref,
lun_id)
invoke.assert_called_once_with('POST', '/storage-systems/{system-id}/'
'symbol/moveLUNMapping',
expected_data)
self.assertEqual({'lun': lun_id}, result)
def test_move_volume_mapping_via_symbol_fail(self):
self.mock_object(self.my_client, '_invoke',
mock.Mock(return_value='failure'))
self.assertRaises(
exception.NetAppDriverException,
self.my_client.move_volume_mapping_via_symbol, '1', '2', 10)
def test_create_host_from_ports_fc(self):
label = 'fake_host'
host_type = 'linux'