Fix test_volumes_snapshots_rbac throwing BadRequest
test_volumes_snapshots_rbac frequently throws a BadRequest
during cleanup with the following message: Invalid snapshot:
Snapshot status must be available or error and must not be part of
a group.
This fix adds waiters to certain snapshot operations so that
cleanup is not attempted while this snapshots are in a state
that would cause this BadRequest error to be thrown.
Change-Id: Ia09f692c8597c9e776dfeca4e67e970d54965cda
Closes-Bug: #1694500
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
index 34889cd..422a3db 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_snapshots_rbac.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
@@ -75,6 +76,9 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.snapshots_client.update_snapshot(
self.snapshot['id'], **params)['snapshot']
+ waiters.wait_for_volume_resource_status(
+ self.os_admin.snapshots_client,
+ self.snapshot['id'], 'available')
@rbac_rule_validation.action(service="cinder",
rule="volume:get_all_snapshots")
@@ -95,6 +99,8 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
# Delete the snapshot
self.snapshots_client.delete_snapshot(temp_snapshot['id'])
+ self.os_admin.snapshots_client.wait_for_resource_deletion(
+ temp_snapshot['id'])
class VolumesSnapshotV3RbacTest(VolumesSnapshotRbacTest):