Verify applying a new cephx rule after a previous failure
This test will create a share and will then assign an access rule
that will fall into the error status and will then create another
access rule on the share.
The test will then verify that the second access rule was applied
successfully.
This patch also refactors "test_different_tenants_cannot_use_same_cephx_id"
to use raise_rule_in_error_state=False.
Added: "allow_access" helper method the grants an access to a
share and deletes it at the end of the test.
Change-Id: If9ffab7fcf37fab77bb4c9fd1863a0316f0a370d
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 7915eaf..8b01cef 100755
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -738,7 +738,8 @@
access_to = "client3.com"
elif protocol in CONF.share.enable_cephx_rules_for_protocols:
access_type = "cephx"
- access_to = "eve"
+ access_to = data_utils.rand_name(
+ cls.__class__.__name__ + '-cephx-id')
else:
message = "Unrecognized protocol and access rules configuration."
raise cls.skipException(message)
@@ -1082,6 +1083,25 @@
self.shares_v2_client.wait_for_share_status(share['id'], "error")
return self.shares_v2_client.wait_for_message(share['id'])
+ def allow_access(self, share_id, client=None, access_type=None,
+ access_level='rw', access_to=None, status='active',
+ raise_rule_in_error_state=True, cleanup=True):
+
+ client = client or self.shares_v2_client
+ a_type, a_to = self._get_access_rule_data_from_config()
+ access_type = access_type or a_type
+ access_to = access_to or a_to
+
+ rule = client.create_access_rule(share_id, access_type, access_to,
+ access_level)
+ client.wait_for_access_rule_status(share_id, rule['id'], status,
+ raise_rule_in_error_state)
+ if cleanup:
+ self.addCleanup(client.wait_for_resource_deletion,
+ rule_id=rule['id'], share_id=share_id)
+ self.addCleanup(client.delete_access_rule, share_id, rule['id'])
+ return rule
+
class BaseSharesAltTest(BaseSharesTest):
"""Base test case class for all Shares Alt API tests."""