Merge "Add test case: clone volume with bad size"
This commit is contained in:
commit
5b37d2aa33
@ -2601,6 +2601,21 @@ class VolumeTestCase(base.BaseVolumeTestCase):
|
|||||||
self.volume.delete_volume(self.context, volume_dst)
|
self.volume.delete_volume(self.context, volume_dst)
|
||||||
self.volume.delete_volume(self.context, volume_src)
|
self.volume.delete_volume(self.context, volume_src)
|
||||||
|
|
||||||
|
def test_create_volume_from_sourcevol_fail_bad_size(self):
|
||||||
|
"""Test cannot clone volume with bad volume size."""
|
||||||
|
volume_src = tests_utils.create_volume(self.context,
|
||||||
|
size=3,
|
||||||
|
status='available',
|
||||||
|
host=CONF.host)
|
||||||
|
|
||||||
|
self.assertRaises(exception.InvalidInput,
|
||||||
|
self.volume_api.create,
|
||||||
|
self.context,
|
||||||
|
size=1,
|
||||||
|
name='fake_name',
|
||||||
|
description='fake_desc',
|
||||||
|
source_volume=volume_src)
|
||||||
|
|
||||||
@mock.patch('cinder.volume.api.API.list_availability_zones',
|
@mock.patch('cinder.volume.api.API.list_availability_zones',
|
||||||
return_value=({'name': 'nova', 'available': True},
|
return_value=({'name': 'nova', 'available': True},
|
||||||
{'name': 'az2', 'available': True}))
|
{'name': 'az2', 'available': True}))
|
||||||
|
Loading…
Reference in New Issue
Block a user