[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
This commit is contained in:
parent
9cefa379a5
commit
782a54dbd3
|
@ -171,6 +171,9 @@ class TestProjectAdminTestsNFS(ShareRbacRulesTests, base.BaseSharesTest):
|
|||
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 @@ class TestProjectAdminTestsNFS(ShareRbacRulesTests, base.BaseSharesTest):
|
|||
'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 @@ class TestProjectMemberTestsNFS(ShareRbacRulesTests, base.BaseSharesTest):
|
|||
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'])
|
||||
|
|
Loading…
Reference in New Issue