Merge "Do not allow to modify access for public share type"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 63b3211..ddf11cd 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -36,7 +36,7 @@
help="The minimum api microversion is configured to be the "
"value of the minimum microversion supported by Manila."),
cfg.StrOpt("max_api_microversion",
- default="2.7",
+ default="2.8",
help="The maximum api microversion is configured to be the "
"value of the latest microversion supported by Manila."),
cfg.StrOpt("region",
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index 877a82f..2282510 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -323,7 +323,8 @@
def manage_share(self, service_host, protocol, export_path,
share_type_id, name=None, description=None,
- version=LATEST_MICROVERSION, url=None):
+ is_public=False, version=LATEST_MICROVERSION,
+ url=None):
post_body = {
"share": {
"export_path": export_path,
@@ -332,6 +333,7 @@
"share_type": share_type_id,
"name": name,
"description": description,
+ "is_public": is_public,
}
}
if url is None:
diff --git a/manila_tempest_tests/tests/api/admin/test_share_manage.py b/manila_tempest_tests/tests/api/admin/test_share_manage.py
index 78255ca..78d28ee 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_manage.py
@@ -75,31 +75,37 @@
'share_type_id': cls.st['share_type']['id'],
'share_protocol': cls.protocol,
}}
- # Create two shares in parallel
- cls.shares = cls.create_shares([creation_data, creation_data])
+ # Data for creating shares in parallel
+ data = [creation_data, creation_data]
+ if float(CONF.share.max_api_microversion) >= 2.8:
+ data.append(creation_data)
+ shares_created = cls.create_shares(data)
+
+ cls.shares = []
# Load all share data (host, etc.)
- cls.share1 = cls.shares_v2_client.get_share(cls.shares[0]['id'])
- cls.share2 = cls.shares_v2_client.get_share(cls.shares[1]['id'])
+ for share in shares_created:
+ # Unmanage shares from manila
+ cls.shares.append(cls.shares_client.get_share(share['id']))
+ cls.shares_client.unmanage_share(share['id'])
+ cls.shares_client.wait_for_resource_deletion(
+ share_id=share['id'])
- # Unmanage shares from manila
- for share_id in (cls.share1['id'], cls.share2['id']):
- cls.shares_v2_client.unmanage_share(share_id)
- cls.shares_v2_client.wait_for_resource_deletion(share_id=share_id)
-
- @test.attr(type=["gate", "smoke"])
- def test_manage(self):
- name = "Name for 'managed' share that had ID %s" % self.share1["id"]
+ def _test_manage(self, share, is_public=False,
+ version=CONF.share.max_api_microversion):
+ name = "Name for 'managed' share that had ID %s" % \
+ share['id']
description = "Description for 'managed' share"
# Manage share
share = self.shares_v2_client.manage_share(
- service_host=self.share1['host'],
- export_path=self.share1['export_locations'][0],
- protocol=self.share1['share_proto'],
+ service_host=share['host'],
+ export_path=share['export_locations'][0],
+ protocol=share['share_proto'],
share_type_id=self.st['share_type']['id'],
name=name,
description=description,
+ is_public=is_public,
)
# Add managed share to cleanup queue
@@ -114,12 +120,17 @@
get = self.shares_v2_client.get_share(share['id'], version="2.5")
self.assertEqual(name, get['name'])
self.assertEqual(description, get['description'])
- self.assertEqual(self.share1['host'], get['host'])
- self.assertEqual(self.share1['share_proto'], get['share_proto'])
+ self.assertEqual(share['host'], get['host'])
+ self.assertEqual(share['share_proto'], get['share_proto'])
self.assertEqual(self.st['share_type']['name'], get['share_type'])
- get = self.shares_v2_client.get_share(share['id'], version="2.6")
- self.assertEqual(self.st['share_type']['id'], get['share_type'])
+ share = self.shares_v2_client.get_share(share['id'], version="2.6")
+ self.assertEqual(self.st['share_type']['id'], share['share_type'])
+
+ if float(version) >= 2.8:
+ self.assertEqual(is_public, share['is_public'])
+ else:
+ self.assertFalse(share['is_public'])
# Delete share
self.shares_v2_client.delete_share(share['id'])
@@ -128,6 +139,17 @@
self.shares_v2_client.get_share,
share['id'])
+ @testtools.skipIf(
+ float(CONF.share.max_api_microversion) < 2.8,
+ "Only for API Microversion >= 2.8")
+ @test.attr(type=["gate", "smoke"])
+ def test_manage_with_is_public_True(self):
+ self._test_manage(share=self.shares[2], is_public=True)
+
+ @test.attr(type=["gate", "smoke"])
+ def test_manage(self):
+ self._test_manage(share=self.shares[0])
+
@test.attr(type=["gate", "smoke"])
def test_manage_retry(self):
# Manage share with invalid parameters
@@ -137,9 +159,9 @@
for share_type_id, status in parameters:
share = self.shares_v2_client.manage_share(
- service_host=self.share2['host'],
- export_path=self.share2['export_locations'][0],
- protocol=self.share2['share_proto'],
+ service_host=self.shares[1]['host'],
+ export_path=self.shares[1]['export_locations'][0],
+ protocol=self.shares[1]['share_proto'],
share_type_id=share_type_id)
# Add managed share to cleanup queue