Skip to content

Commit

Permalink
sync unit tests change on 2017/03/22
Browse files Browse the repository at this point in the history
It's an useless unit test, but it still got merged.
So, just ignore it and we need to sync from master.
  • Loading branch information
johnnychou committed Mar 27, 2017
1 parent 3e5cdfb commit 5657405
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/test_infortrend_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,43 @@ def test_create_volume_from_snapshot(self, log_info):
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_volume_from_snapshot_with_different_size(self, log_info):

test_snapshot = self.cli_data.test_snapshot
test_snapshot_id = self.cli_data.fake_snapshot_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_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 = {
'ShowSnapshot':
self.cli_data.get_test_show_snapshot_detail_filled_block(),
'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(
test_snapshot_id, test_dst_part_id, test_dst_volume_id),
'DeleteReplica': SUCCEED,
}
self._driver_setup(mock_commands)

model_update = self.driver.create_volume_from_snapshot(
test_dst_volume, test_snapshot)
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
self.assertEqual(10, test_dst_volume['size'])

def test_create_volume_from_snapshot_without_provider_location(
self):

Expand Down

0 comments on commit 5657405

Please sign in to comment.