diff options
| author | Akihiro Motoki <amotoki@gmail.com> | 2017-05-21 03:36:23 +0000 |
|---|---|---|
| committer | Akihiro Motoki <amotoki@gmail.com> | 2017-06-06 01:14:20 +0000 |
| commit | eeb614c47759fa9a01e6d886ed07acceb8d9ff61 (patch) | |
| tree | 962d227b3d2844f8af7a77312bfea5122a1bc8e1 /openstackclient/tests/functional/compute/v2/test_server.py | |
| parent | c5524c80be4cd3e2443dc9539d1bf21eb3b8e297 (diff) | |
| download | python-openstackclient-eeb614c47759fa9a01e6d886ed07acceb8d9ff61.tar.gz | |
volume functest: ensure snapshots deleted when volume delete
Deleting snapshot may take time. The current volume API does not allow
to delete volumes with snapshots, so if deleting snapshot may take time,
a delete request for a parent volume will fail.
This sometimes causes functional test failures in slow environments.
wait_for_status() checks whether volume status is in error statuses
but previously the expected error status was wrong. Cinder API uses
lower case as volume status, so it did not work expectedly.
Change-Id: I095894ba39f23bf81d71351818d24dbb5ca459fb
Diffstat (limited to 'openstackclient/tests/functional/compute/v2/test_server.py')
| -rw-r--r-- | openstackclient/tests/functional/compute/v2/test_server.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index a4b29024..c9f4d62c 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -17,7 +17,7 @@ from tempest.lib import exceptions from openstackclient.tests.functional import base from openstackclient.tests.functional.compute.v2 import common -from openstackclient.tests.functional.volume.v2 import test_volume +from openstackclient.tests.functional.volume.v2 import common as volume_common class ServerTests(common.ComputeTestCase): @@ -282,9 +282,7 @@ class ServerTests(common.ComputeTestCase): def test_server_boot_from_volume(self): """Test server create from volume, server delete""" # get volume status wait function - volume_wait_for = test_volume.VolumeTests( - methodName='wait_for', - ).wait_for + volume_wait_for = volume_common.BaseVolumeTests.wait_for_status # get image size cmd_output = json.loads(self.openstack( @@ -391,9 +389,8 @@ class ServerTests(common.ComputeTestCase): def test_server_boot_with_bdm_snapshot(self): """Test server create from image with bdm snapshot, server delete""" # get volume status wait function - volume_wait_for = test_volume.VolumeTests( - methodName='wait_for', - ).wait_for + volume_wait_for = volume_common.BaseVolumeTests.wait_for_status + volume_wait_for_delete = volume_common.BaseVolumeTests.wait_for_delete # create source empty volume empty_volume_name = uuid.uuid4().hex @@ -419,6 +416,13 @@ class ServerTests(common.ComputeTestCase): empty_snapshot_name )) self.assertIsNotNone(cmd_output["id"]) + # Deleting volume snapshot take time, so we need to wait until the + # snapshot goes. Entries registered by self.addCleanup will be called + # in the reverse order, so we need to register wait_for_delete first. + self.addCleanup(volume_wait_for_delete, + 'volume snapshot', empty_snapshot_name) + self.addCleanup(self.openstack, + 'volume snapshot delete ' + empty_snapshot_name) self.assertEqual( empty_snapshot_name, cmd_output['name'], @@ -489,12 +493,6 @@ class ServerTests(common.ComputeTestCase): # the attached volume had been deleted pass - # clean up volume snapshot manually, make sure the snapshot and volume - # can be deleted sequentially, self.addCleanup so fast, that cause - # volume service API 400 error and the volume is left over at the end. - self.openstack('volume snapshot delete ' + empty_snapshot_name) - volume_wait_for('volume snapshot', empty_snapshot_name, 'disappear') - def test_server_create_with_none_network(self): """Test server create with none network option.""" server_name = uuid.uuid4().hex |
