From: Mathieu Gagné Date: Fri, 19 Jul 2013 19:49:54 +0000 (-0400) Subject: Add test for volume status check when extending X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=25b75a640c6979b64d4eee62e88261101916fe50;p=openstack-build%2Fcinder-build.git Add test for volume status check when extending Ensure exception is raised if volume status is not 'available' when extending volume. Change-Id: I21337d5ca78090665b2feba50c74f853d3703650 --- diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 544ee2706..41c389b6e 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -1254,11 +1254,19 @@ class VolumeTestCase(test.TestCase): # create a volume and assign to host volume = self._create_volume(2) self.volume.create_volume(self.context, volume['id']) - volume['status'] = 'available' + volume['status'] = 'in-use' volume['host'] = 'fakehost' volume_api = cinder.volume.api.API() + # Extend fails when status != available + self.assertRaises(exception.InvalidVolume, + volume_api.extend, + self.context, + volume, + 3) + + volume['status'] = 'available' # Extend fails when new_size < orig_size self.assertRaises(exception.InvalidInput, volume_api.extend,