Merge "New test case for InfroTrend driver"

This commit is contained in:
Jenkins 2017-03-27 23:32:34 +00:00 committed by Gerrit Code Review
commit 5d10ed5367
1 changed files with 37 additions and 0 deletions

View File

@ -977,6 +977,43 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
@mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall',
new=utils.ZeroIntervalLoopingCall)
@mock.patch.object(common_cli.LOG, 'info')
def test_create_cloned_volume_different_size(self, log_info):
fake_partition_id = self.cli_data.fake_partition_id[0]
test_dst_volume = self.cli_data.test_dst_volume
test_dst_volume['size'] = 10
test_dst_volume_id = test_dst_volume['id'].replace('-', '')
test_src_volume = self.cli_data.test_volume
test_dst_part_id = self.cli_data.fake_partition_id[1]
test_model_update = {
'provider_location': 'partition_id^%s@system_id^%s' % (
self.cli_data.fake_partition_id[1],
int(self.cli_data.fake_system_id[0], 16))
}
mock_commands = {
'CreatePartition': SUCCEED,
'ShowPartition': self.cli_data.get_test_show_partition(),
'ShowDevice': self.cli_data.get_test_show_device(),
'CreateReplica': SUCCEED,
'ShowLV': self._mock_show_lv,
'ShowReplica':
self.cli_data.get_test_show_replica_detail_for_migrate(
fake_partition_id, test_dst_part_id, test_dst_volume_id),
'DeleteReplica': SUCCEED,
}
self._driver_setup(mock_commands)
model_update = self.driver.create_cloned_volume(
test_dst_volume, test_src_volume)
self.assertDictEqual(test_model_update, model_update)
log_info.assert_called_once()
self.assertEqual(10, test_dst_volume['size'])
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_create_cloned_volume_with_create_replica_fail(self):