[RBAC] Wait for access rules to be applied prior to deletion
For some backends, the access rules might take some time to apply,
and if we try to clean up the rule before it was applied, we would
end up in a race condition.
In order to avoid this issue, we can wait for the access rule to be
active before proceeding to do other steps in the test.
Change-Id: Ib57eda56fdbec398d4dc6e80e982ace5f14727bb
diff --git a/manila_tempest_tests/tests/rbac/test_rules.py b/manila_tempest_tests/tests/rbac/test_rules.py
index fe51f44..8a6d46f 100644
--- a/manila_tempest_tests/tests/rbac/test_rules.py
+++ b/manila_tempest_tests/tests/rbac/test_rules.py
@@ -171,6 +171,9 @@
access = self.do_request(
'create_access_rule', expected_status=200,
**self.access(self.share['id'], access_type, access_to))['access']
+ waiters.wait_for_resource_status(
+ self.client, self.share["id"], "active",
+ resource_name='access_rule', rule_id=access["id"])
self.addCleanup(
self.client.wait_for_resource_deletion, rule_id=access['id'],
share_id=self.share['id'])
@@ -181,6 +184,9 @@
'create_access_rule', expected_status=200,
**self.access(
self.alt_share['id'], access_type, access_to))['access']
+ waiters.wait_for_resource_status(
+ self.client, self.alt_share["id"], "active",
+ resource_name='access_rule', rule_id=alt_access["id"])
self.addCleanup(
self.client.wait_for_resource_deletion, rule_id=alt_access['id'],
share_id=self.alt_share['id'])
@@ -318,6 +324,9 @@
access = self.do_request(
'create_access_rule', client=share_client, expected_status=200,
**self.access(self.share['id'], access_type, access_to))['access']
+ waiters.wait_for_resource_status(
+ share_client, self.share["id"], "active",
+ resource_name='access_rule', rule_id=access["id"])
self.addCleanup(
self.client.wait_for_resource_deletion, rule_id=access['id'],
share_id=self.share['id'])