Add waiter to test_manage_snapshot_rbac to fix data race
This PS adds a waiter after attempting to manage a snapshot
in test_manage_snapshot_rbac to avoid data race conditions
causing the test to fail during resource_cleanup [0].
This also adds a clean up to the test which is currently missing.
[0] http://logs.openstack.org/77/537977/1/check/patrole-admin/c4e6884/job-output.txt.gz#_2018-02-01_02_47_26_276336
Change-Id: Ib62a6d7ebbc5af43278c97fedce3a863ecfd3575
diff --git a/patrole_tempest_plugin/tests/api/volume/test_snapshot_manage_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_snapshot_manage_rbac.py
index c71a1e1..d238045 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_snapshot_manage_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_snapshot_manage_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.common.utils import data_utils
from tempest.lib import decorators
@@ -54,21 +55,20 @@
def test_manage_snapshot_rbac(self):
name = data_utils.rand_name(self.__class__.__name__ +
'-Managed-Snapshot')
- description = data_utils.rand_name(self.__class__.__name__ +
- '-Managed-Snapshot-Description')
- metadata = {"manage-snap-meta1": "value1",
- "manage-snap-meta2": "value2",
- "manage-snap-meta3": "value3"}
snapshot_ref = {
'volume_id': self.volume['id'],
'ref': {CONF.volume.manage_snapshot_ref[0]:
CONF.volume.manage_snapshot_ref[1] % self.snapshot['id']},
- 'name': name,
- 'description': description,
- 'metadata': metadata
+ 'name': name
}
with self.rbac_utils.override_role(self):
- self.snapshot_manage_client.manage_snapshot(**snapshot_ref)
+ snapshot = self.snapshot_manage_client.manage_snapshot(
+ **snapshot_ref)['snapshot']
+ self.addCleanup(self.delete_snapshot, snapshot['id'],
+ self.snapshots_client)
+ waiters.wait_for_volume_resource_status(self.snapshots_client,
+ snapshot['id'],
+ 'available')
@decorators.idempotent_id('4a2e8934-9c0b-434e-8f0b-e18b9aff126f')
@rbac_rule_validation.action(