From 25b75a640c6979b64d4eee62e88261101916fe50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Fri, 19 Jul 2013 15:49:54 -0400 Subject: [PATCH] Add test for volume status check when extending Ensure exception is raised if volume status is not 'available' when extending volume. Change-Id: I21337d5ca78090665b2feba50c74f853d3703650 --- cinder/tests/test_volume.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 544ee270688..41c389b6e6e 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,