Update volume detach smoke test to check status.

Updates test_007_me_can_detach_volume so that it waits for
the volume status to become active for up to 10 seconds
after initiating the command to detach the volume.

Previously it just waited for 5 seconds without checking the
status which can be problematic in that it causes the
subsequent test to delete the volume to fail intermittently
(because only active or error volumes can be deleted).

I noticed this in SmokeStack because 2 days ago this commit landed:

b46f224f75

and it is now causing a fair amount of intermittent volume
tests to fail for Nova and Cinder. Apparently now that we
have ordered the commands to remove an iscsi target properly
it takes a bit longer...

Change-Id: Ibfd25af93f9cb063a76a04138b8d23d28a01b89a
This commit is contained in:
Dan Prince 2012-09-21 12:15:59 -04:00 committed by Russell Bryant
parent 4e4c484fc4
commit c843160733
1 changed files with 8 additions and 1 deletions

View File

@ -308,7 +308,14 @@ class VolumeTests(base.UserSmokeTestCase):
def test_007_me_can_detach_volume(self):
result = self.conn.detach_volume(volume_id=self.data['volume'].id)
self.assertTrue(result)
time.sleep(5)
volume = self.data['volume']
for x in xrange(10):
volume.update()
if volume.status.startswith('available'):
break
time.sleep(1)
else:
self.fail('cannot detach volume. state %s' % volume.status)
def test_008_me_can_delete_volume(self):
result = self.conn.delete_volume(self.data['volume'].id)