diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2019-02-04 12:48:20 -0600 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-02-06 15:40:25 -0600 |
| commit | 1a0bef2b46c76e1c6308def709199c30c68aae47 (patch) | |
| tree | 4ad41bcfe74e9709d87eed2d2447037bd6398dad /openstackclient/tests/functional | |
| parent | dcff1012fd979f25028052147883bd709b825ea1 (diff) | |
| download | python-openstackclient-1a0bef2b46c76e1c6308def709199c30c68aae47.tar.gz | |
More state handling in volume transfer requests functional tests
Using addCleanup() for removing the pending volume transfer request
has no way to wait for the volume status to become available before
cleaning up the volume and gets racy when the tests are run with
slow performance in the volume backend. So we pause at the end of
the test after either accepting the transfer request or explicitly
deleting it so the cleanup can delete the volume.
Change-Id: I04862069cab28bc76eeafd60ba32be646f478d86
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Diffstat (limited to 'openstackclient/tests/functional')
| -rw-r--r-- | openstackclient/tests/functional/volume/v2/test_transfer_request.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/openstackclient/tests/functional/volume/v2/test_transfer_request.py b/openstackclient/tests/functional/volume/v2/test_transfer_request.py index d6aff73c..00d0865c 100644 --- a/openstackclient/tests/functional/volume/v2/test_transfer_request.py +++ b/openstackclient/tests/functional/volume/v2/test_transfer_request.py @@ -49,17 +49,20 @@ class TransferRequestTests(common.BaseVolumeTests): volume_name )) self.assertEqual(xfer_name, cmd_output['name']) + xfer_id = cmd_output['id'] auth_key = cmd_output['auth_key'] self.assertTrue(auth_key) + self.wait_for_status("volume", volume_name, "awaiting-transfer") # accept the volume transfer request cmd_output = json.loads(self.openstack( '--os-volume-api-version ' + self.API_VERSION + ' ' + 'volume transfer request accept -f json ' + '--auth-key ' + auth_key + ' ' + - xfer_name + xfer_id )) self.assertEqual(xfer_name, cmd_output['name']) + self.wait_for_status("volume", volume_name, "available") def test_volume_transfer_request_list_show(self): volume_name = uuid.uuid4().hex @@ -86,15 +89,11 @@ class TransferRequestTests(common.BaseVolumeTests): ' --name ' + xfer_name + ' ' + volume_name )) - self.addCleanup( - self.openstack, - '--os-volume-api-version ' + self.API_VERSION + ' ' + - 'volume transfer request delete ' + - xfer_name - ) self.assertEqual(xfer_name, cmd_output['name']) + xfer_id = cmd_output['id'] auth_key = cmd_output['auth_key'] self.assertTrue(auth_key) + self.wait_for_status("volume", volume_name, "awaiting-transfer") cmd_output = json.loads(self.openstack( '--os-volume-api-version ' + self.API_VERSION + ' ' + @@ -105,6 +104,18 @@ class TransferRequestTests(common.BaseVolumeTests): cmd_output = json.loads(self.openstack( '--os-volume-api-version ' + self.API_VERSION + ' ' + 'volume transfer request show -f json ' + - xfer_name + xfer_id )) self.assertEqual(xfer_name, cmd_output['name']) + + # NOTE(dtroyer): We need to delete the transfer request to allow the + # volume to be deleted. The addCleanup() route does + # not have a mechanism to wait for the volume status + # to become 'available' before attempting to delete + # the volume. + cmd_output = self.openstack( + '--os-volume-api-version ' + self.API_VERSION + ' ' + + 'volume transfer request delete ' + + xfer_id + ) + self.wait_for_status("volume", volume_name, "available") |
