Update share quota functional tests
- Updates the existent functional tests to accomplish with the two
new quotas for share replicas.
- Add new functional tests for share replicas
Depends-On: I8ba7bc6f167c28d6c169b2187d0e1bda7cad3f69
Change-Id: I9c5df364bca666bbc32fb10b100a38f78888088a
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 774714b..042be5a 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -30,7 +30,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.52",
+ default="2.53",
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 b19872b..d8b7ed4 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -1032,8 +1032,9 @@
snapshots=None, gigabytes=None, snapshot_gigabytes=None,
share_networks=None,
share_groups=None, share_group_snapshots=None,
- force=True, share_type=None,
- url=None, version=LATEST_MICROVERSION):
+ force=True, share_type=None, share_replicas=None,
+ replica_gigabytes=None, url=None,
+ version=LATEST_MICROVERSION):
if url is None:
url = self._get_quotas_url(version)
url += '/%s' % tenant_id
@@ -1056,6 +1057,10 @@
put_body["share_groups"] = share_groups
if share_group_snapshots is not None:
put_body["share_group_snapshots"] = share_group_snapshots
+ if share_replicas is not None:
+ put_body["share_replicas"] = share_replicas
+ if replica_gigabytes is not None:
+ put_body["replica_gigabytes"] = replica_gigabytes
put_body = json.dumps({"quota_set": put_body})
resp, body = self.put(url, put_body, version=version)
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index ab0d665..215b25d 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -26,6 +26,8 @@
CONF = config.CONF
PRE_SHARE_GROUPS_MICROVERSION = "2.39"
SHARE_GROUPS_MICROVERSION = "2.40"
+PRE_SHARE_REPLICA_QUOTAS_MICROVERSION = "2.52"
+SHARE_REPLICA_QUOTAS_MICROVERSION = "2.53"
@ddt.ddt
@@ -54,6 +56,9 @@
if utils.is_microversion_supported(SHARE_GROUPS_MICROVERSION):
self.assertGreater(int(quotas["share_groups"]), -2)
self.assertGreater(int(quotas["share_group_snapshots"]), -2)
+ if utils.share_replica_quotas_are_supported():
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
def test_show_quotas(self):
@@ -66,6 +71,9 @@
if utils.is_microversion_supported(SHARE_GROUPS_MICROVERSION):
self.assertGreater(int(quotas["share_groups"]), -2)
self.assertGreater(int(quotas["share_group_snapshots"]), -2)
+ if utils.share_replica_quotas_are_supported():
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
def test_show_quotas_for_user(self):
@@ -79,6 +87,9 @@
if utils.is_microversion_supported(SHARE_GROUPS_MICROVERSION):
self.assertGreater(int(quotas["share_groups"]), -2)
self.assertGreater(int(quotas["share_group_snapshots"]), -2)
+ if utils.share_replica_quotas_are_supported():
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@base.skip_if_microversion_not_supported(PRE_SHARE_GROUPS_MICROVERSION)
@@ -99,6 +110,17 @@
for key in ('share_groups', 'share_group_snapshots'):
self.assertNotIn(key, quotas)
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported(
+ PRE_SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_show_replica_quotas_for_user_using_too_old_microversion(self):
+ quotas = self.shares_v2_client.show_quotas(
+ self.tenant_id, self.user_id,
+ version=PRE_SHARE_REPLICA_QUOTAS_MICROVERSION)
+
+ for key in('share_replicas', 'replica_gigabytes'):
+ self.assertNotIn(key, quotas)
+
@ddt.data(
('id', True),
('name', False),
@@ -107,6 +129,10 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@base.skip_if_microversion_lt("2.39")
def test_show_share_type_quotas(self, share_type_key, is_st_public):
+ # Check if the used microversion supports 'share_replica' and
+ # 'replica_gigabytes' quotas
+ replica_quotas_supported = utils.share_replica_quotas_are_supported()
+
# Create share type
share_type = self.create_share_type(
data_utils.rand_name("tempest-manila"),
@@ -117,6 +143,12 @@
if 'share_type' in share_type:
share_type = share_type['share_type']
+ keys = ['shares', 'gigabytes', 'snapshots', 'snapshot_gigabytes']
+
+ if replica_quotas_supported:
+ keys.append('share_replicas')
+ keys.append('replica_gigabytes')
+
# Get current project quotas
p_quotas = self.shares_v2_client.show_quotas(self.tenant_id)
@@ -125,7 +157,7 @@
self.tenant_id, share_type=share_type[share_type_key])
# Share type quotas have values equal to project's
- for key in ('shares', 'gigabytes', 'snapshots', 'snapshot_gigabytes'):
+ for key in keys:
self.assertEqual(st_quotas[key], p_quotas[key])
# Verify that we do not have share groups related quotas
@@ -215,6 +247,31 @@
self.tenant_id, self.user_id, **{quota_key: new_quota})
self.assertEqual(new_quota, int(updated[quota_key]))
+ @ddt.data(("share_replicas", False),
+ ("share_replicas", True),
+ ("replica_gigabytes", False),
+ ("replica_gigabytes", True),
+ )
+ @ddt.unpack
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported(SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_update_user_quota_replica_related(self, quota_key, use_user_id):
+ kwargs = {}
+
+ # Update the kwargs with user_id in case the user_id need to be
+ # specified in the request
+ kwargs.update({'user_id': self.user_id}) if use_user_id else None
+ quotas = self.client.show_quotas(self.tenant_id, **kwargs)
+ new_quota = int(quotas[quota_key]) - 1
+
+ # Add the updated quota into the kwargs
+ kwargs.update({quota_key: new_quota})
+
+ # Set the new quota based on tenant or tenant and user_id
+ updated = self.client.update_quotas(
+ self.tenant_id, **kwargs)
+ self.assertEqual(new_quota, int(updated[quota_key]))
+
@ddt.data(
('id', True),
('name', False),
@@ -223,14 +280,22 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@base.skip_if_microversion_lt("2.39")
def test_update_share_type_quota(self, share_type_key, is_st_public):
+ # Check if the used microversion supports 'share_replica' and
+ # 'replica_gigabytes' quotas
+ replica_quotas_supported = utils.share_replica_quotas_are_supported()
share_type = self._create_share_type()
# Get current quotas
quotas = self.client.show_quotas(
self.tenant_id, share_type=share_type[share_type_key])
+ quota_keys = ['shares', 'gigabytes', 'snapshots', 'snapshot_gigabytes']
+
+ if replica_quotas_supported:
+ quota_keys.append('share_replicas')
+ quota_keys.append('replica_gigabytes')
# Update quotas
- for q in ('shares', 'gigabytes', 'snapshots', 'snapshot_gigabytes'):
+ for q in quota_keys:
new_quota = int(quotas[q]) - 1
# Set new quota
@@ -242,7 +307,7 @@
current_quotas = self.client.show_quotas(
self.tenant_id, share_type=share_type[share_type_key])
- for q in ('shares', 'gigabytes', 'snapshots', 'snapshot_gigabytes'):
+ for q in quota_keys:
self.assertEqual(int(quotas[q]) - 1, current_quotas[q])
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@@ -368,6 +433,9 @@
data["share_groups"] = int(custom["share_groups"]) + 2
data["share_group_snapshots"] = (
int(custom["share_group_snapshots"]) + 2)
+ if utils.share_replica_quotas_are_supported():
+ data["share_replicas"] = int(custom["share_replicas"]) + 2
+ data["replica_gigabytes"] = int(custom["replica_gigabytes"]) + 2
# set new quota
updated = self.client.update_quotas(self.tenant_id, **data)
@@ -385,6 +453,11 @@
self.assertEqual(
data["share_group_snapshots"],
int(updated["share_group_snapshots"]))
+ if utils.share_replica_quotas_are_supported():
+ self.assertEqual(
+ data["share_replicas"], int(updated["share_replicas"]))
+ self.assertEqual(
+ data["replica_gigabytes"], int(updated["replica_gigabytes"]))
# Reset customized quotas
self.client.reset_quotas(self.tenant_id)
@@ -406,6 +479,21 @@
self.assertEqual(
int(default["share_group_snapshots"]),
int(reseted["share_group_snapshots"]))
+ if utils.share_replica_quotas_are_supported():
+ self.assertEqual(
+ int(default["share_replicas"]), int(reseted["share_replicas"]))
+ self.assertEqual(
+ int(default["replica_gigabytes"]),
+ int(reseted["replica_gigabytes"]))
+
+ def _get_new_replica_quota_values(self, default_quotas, value_to_set):
+ new_values = {
+ 'share_replicas': int(
+ default_quotas['share_replicas']) + value_to_set,
+ 'replica_gigabytes': int(
+ default_quotas['replica_gigabytes']) + value_to_set
+ }
+ return new_values
@ddt.data(
('id', True),
@@ -416,17 +504,34 @@
@base.skip_if_microversion_lt("2.39")
def test_reset_share_type_quotas(self, share_type_key, is_st_public):
share_type = self._create_share_type()
+ quota_keys = ['shares', 'snapshots', 'gigabytes', 'snapshot_gigabytes']
# get default_quotas
default_quotas = self.client.default_quotas(self.tenant_id)
+ kwargs = {}
+
+ # check if the replica_gigabytes and share_replicas quotas are
+ # supported
+ if utils.share_replica_quotas_are_supported():
+ kwargs.update(self._get_new_replica_quota_values(
+ default_quotas, 5))
+ quota_keys.append('share_replicas')
+ quota_keys.append('replica_gigabytes')
+
# set new quota for project
updated_p_quota = self.client.update_quotas(
self.tenant_id,
shares=int(default_quotas['shares']) + 5,
snapshots=int(default_quotas['snapshots']) + 5,
gigabytes=int(default_quotas['gigabytes']) + 5,
- snapshot_gigabytes=int(default_quotas['snapshot_gigabytes']) + 5)
+ snapshot_gigabytes=int(default_quotas['snapshot_gigabytes']) + 5,
+ **kwargs
+ )
+
+ if utils.share_replica_quotas_are_supported():
+ kwargs.update(self._get_new_replica_quota_values(
+ default_quotas, 3))
# set new quota for project
self.client.update_quotas(
@@ -435,7 +540,9 @@
shares=int(default_quotas['shares']) + 3,
snapshots=int(default_quotas['snapshots']) + 3,
gigabytes=int(default_quotas['gigabytes']) + 3,
- snapshot_gigabytes=int(default_quotas['snapshot_gigabytes']) + 3)
+ snapshot_gigabytes=int(default_quotas['snapshot_gigabytes']) + 3,
+ **kwargs
+ )
# reset share type quotas
self.client.reset_quotas(
@@ -445,7 +552,7 @@
current_p_quota = self.client.show_quotas(self.tenant_id)
current_st_quota = self.client.show_quotas(
self.tenant_id, share_type=share_type[share_type_key])
- for key in ('shares', 'snapshots', 'gigabytes', 'snapshot_gigabytes'):
+ for key in quota_keys:
self.assertEqual(updated_p_quota[key], current_p_quota[key])
# Default share type quotas are current project quotas
@@ -561,6 +668,30 @@
self.assertEqual(-1, quotas.get('share_group_snapshots'))
+ @ddt.data("share_replicas", "replica_gigabytes")
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @utils.skip_if_microversion_not_supported(
+ SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_unlimited_quota_for_replica_quotas(self, quota_key):
+ kwargs = {quota_key: -1}
+ self.client.update_quotas(self.tenant_id, **kwargs)
+
+ quotas = self.client.show_quotas(self.tenant_id)
+
+ self.assertEqual(-1, quotas.get(quota_key))
+
+ @ddt.data("share_replicas", "replica_gigabytes")
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @utils.skip_if_microversion_not_supported(
+ SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_unlimited_user_quota_for_replica_quotas(self, quota_key):
+ kwargs = {quota_key: -1}
+ self.client.update_quotas(self.tenant_id, self.user_id, **kwargs)
+
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
+
+ self.assertEqual(-1, quotas.get(quota_key))
+
@ddt.data(11, -1)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
def test_update_user_quotas_bigger_than_project_quota(self, user_quota):
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
index 299d54d..ae5e227 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -14,6 +14,7 @@
# under the License.
import ddt
+import manila_tempest_tests.tests.api.test_replication_negative as rep_neg_test
from tempest import config
from tempest.lib import exceptions as lib_exc
import testtools
@@ -25,6 +26,8 @@
CONF = config.CONF
PRE_SHARE_GROUPS_MICROVERSION = "2.39"
SHARE_GROUPS_MICROVERSION = "2.40"
+PRE_SHARE_REPLICA_QUOTAS_MICROVERSION = "2.52"
+SHARE_REPLICA_QUOTAS_MICROVERSION = "2.53"
@ddt.ddt
@@ -88,6 +91,21 @@
lib_exc.BadRequest,
client.update_quotas, client.tenant_id, **kwargs)
+ @ddt.data(
+ {"share_replicas": -2},
+ {"replica_gigabytes": -2},
+ )
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+ @utils.skip_if_microversion_not_supported(
+ SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_update_replica_quotas_wrong_data(self, kwargs):
+ # -1 is acceptable value as unlimited
+
+ client = self.get_client_with_isolated_creds(client_version='2')
+ self.assertRaises(
+ lib_exc.BadRequest,
+ client.update_quotas, client.tenant_id, **kwargs)
+
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_create_share_with_size_bigger_than_quota(self):
quotas = self.shares_client.show_quotas(
@@ -196,6 +214,26 @@
force=False,
share_networks=bigger_value)
+ @ddt.data("share_replicas", "replica_gigabytes")
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+ @utils.skip_if_microversion_not_supported(
+ SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_try_set_user_quota_replicas_bigger_than_tenant_quota(self, key):
+ client = self.get_client_with_isolated_creds(client_version='2')
+
+ # get current quotas for tenant
+ tenant_quotas = client.show_quotas(client.tenant_id)
+
+ # try set user quota for snapshots bigger than tenant quota
+ bigger_value = int(tenant_quotas[key]) + 2
+ kwargs = {key: bigger_value}
+ self.assertRaises(lib_exc.BadRequest,
+ client.update_quotas,
+ client.tenant_id,
+ client.user_id,
+ force=False,
+ **kwargs)
+
@ddt.data(
('quota-sets', '2.0', 'show_quotas'),
('quota-sets', '2.0', 'default_quotas'),
@@ -302,6 +340,24 @@
client.tenant_id,
**kwargs)
+ @ddt.data("share_replicas", "replica_gigabytes")
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported(SHARE_REPLICA_QUOTAS_MICROVERSION)
+ def test_share_replica_quotas_using_too_old_microversion(self, quota_key):
+ client = self.get_client_with_isolated_creds(client_version='2')
+ tenant_quotas = client.show_quotas(
+ client.tenant_id, version=SHARE_REPLICA_QUOTAS_MICROVERSION)
+ kwargs = {
+ "version": PRE_SHARE_REPLICA_QUOTAS_MICROVERSION,
+ quota_key: tenant_quotas[quota_key],
+ }
+
+ self.assertRaises(
+ lib_exc.BadRequest,
+ client.update_quotas,
+ client.tenant_id,
+ **kwargs)
+
@ddt.data('show', 'reset', 'update')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@base.skip_if_microversion_lt("2.38")
@@ -366,3 +422,77 @@
self.assertRaises(lib_exc.OverLimit,
self.create_share,
share_type_id=self.share_type_id)
+
+
+@ddt.ddt
+class ReplicaQuotasNegativeTest(rep_neg_test.ReplicationNegativeBase):
+
+ @classmethod
+ def skip_checks(cls):
+ super(ReplicaQuotasNegativeTest, cls).skip_checks()
+ if not CONF.share.run_quota_tests:
+ msg = "Quota tests are disabled."
+ raise cls.skipException(msg)
+
+ utils.check_skip_if_microversion_lt(SHARE_REPLICA_QUOTAS_MICROVERSION)
+
+ def _modify_quotas_for_test(self, quota_key, new_limit):
+ kwargs = {quota_key: new_limit}
+
+ # Get the original quota values
+ original_quota = self.admin_client.show_quotas(self.tenant_id)
+
+ # Update the current quotas
+ self.admin_client.update_quotas(self.tenant_id, **kwargs)
+
+ # Save the previous value
+ old_quota_values = {quota_key: original_quota[quota_key]}
+
+ # Get the updated quotas and add a cleanup
+ updated_quota = self.admin_client.show_quotas(self.tenant_id)
+ self.addCleanup(self.admin_client.update_quotas,
+ self.tenant_id,
+ **old_quota_values)
+
+ # Make sure that the new value was properly set
+ self.assertEqual(new_limit, updated_quota[quota_key])
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ @ddt.data(('share_replicas', 2), ('replica_gigabytes', None))
+ @ddt.unpack
+ def test_create_replica_over_replica_limit(self, quota_key, new_limit):
+ # Define the quota values to be updated
+ new_limit = (int(self.share1['size'] * 2)
+ if quota_key == 'replica_gigabytes' else new_limit)
+
+ # Create an inactive share replica
+ self.create_share_replica(
+ self.share1["id"], self.replica_zone, cleanup_in_class=False)
+
+ # Modify the quota limit for this test
+ self._modify_quotas_for_test(quota_key, new_limit)
+
+ # Make sure that the request to create a third one will fail
+ self.assertRaises(lib_exc.OverLimit,
+ self.create_share_replica,
+ self.share1['id'],
+ availability_zone=self.replica_zone)
+
+ @testtools.skipUnless(
+ CONF.share.run_extend_tests,
+ "Share extend tests are disabled.")
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ def test_extend_replica_over_limit(self):
+ # Define the quota values to be updated
+ quota_key = 'replica_gigabytes'
+
+ # Modify the quota limit for this test
+ self._modify_quotas_for_test(quota_key, new_limit=self.share1['size'])
+
+ new_size = self.share1['size'] + 1
+
+ # Make sure that the request to create a third one will fail
+ self.assertRaises(lib_exc.OverLimit,
+ self.shares_v2_client.extend_share,
+ self.share1['id'],
+ new_size)
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index 83c776f..d7137f5 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -15,12 +15,15 @@
import ddt
import itertools
+from manila_tempest_tests import utils
from tempest import config
from testtools import testcase as tc
from manila_tempest_tests.tests.api import base
CONF = config.CONF
+PRE_SHARE_REPLICAS_MICROVERSION = "2.52"
+SHARE_REPLICAS_MICROVERSION = "2.53"
@ddt.ddt
@@ -39,35 +42,49 @@
@ddt.data('shares_client', 'shares_v2_client')
def test_default_quotas(self, client_name):
quotas = getattr(self, client_name).default_quotas(self.tenant_id)
+ uses_v2_client = client_name == 'shares_v2_client'
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
+ if utils.share_replica_quotas_are_supported() and uses_v2_client:
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@ddt.data('shares_client', 'shares_v2_client')
def test_show_quotas(self, client_name):
quotas = getattr(self, client_name).show_quotas(self.tenant_id)
+ uses_v2_client = client_name == 'shares_v2_client'
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
+ if utils.share_replica_quotas_are_supported() and uses_v2_client:
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@ddt.data('shares_client', 'shares_v2_client')
def test_show_quotas_for_user(self, client_name):
quotas = getattr(self, client_name).show_quotas(
self.tenant_id, self.user_id)
+ uses_v2_client = client_name == 'shares_v2_client'
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
+ if utils.share_replica_quotas_are_supported() and uses_v2_client:
+ self.assertGreater(int(quotas["share_replicas"]), -2)
+ self.assertGreater(int(quotas["replica_gigabytes"]), -2)
@ddt.data(
*itertools.product(set(("2.25", CONF.share.max_api_microversion)),
+ (True, False)),
+ *itertools.product(set(("2.53", CONF.share.max_api_microversion)),
(True, False))
)
@ddt.unpack
@@ -75,14 +92,27 @@
@base.skip_if_microversion_not_supported("2.25")
def test_show_quotas_detail(self, microversion, with_user):
quota_args = {"tenant_id": self.tenant_id, "version": microversion, }
+ keys = ['gigabytes', 'snapshot_gigabytes', 'shares',
+ 'snapshots', 'share_networks']
+ if utils.is_microversion_ge(microversion, SHARE_REPLICAS_MICROVERSION):
+ keys.append('share_replicas')
+ keys.append('replica_gigabytes')
if with_user:
quota_args.update({"user_id": self.user_id})
quotas = self.shares_v2_client.detail_quotas(**quota_args)
quota_keys = list(quotas.keys())
- for outer in ('gigabytes', 'snapshot_gigabytes', 'shares',
- 'snapshots', 'share_networks'):
+ for outer in keys:
self.assertIn(outer, quota_keys)
outer_keys = list(quotas[outer].keys())
for inner in ('in_use', 'limit', 'reserved'):
self.assertIn(inner, outer_keys)
self.assertGreater(int(quotas[outer][inner]), -2)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported(PRE_SHARE_REPLICAS_MICROVERSION)
+ def test_quota_detail_2_52_no_share_replica_quotas(self):
+ quota_args = {"tenant_id": self.tenant_id,
+ "version": PRE_SHARE_REPLICAS_MICROVERSION}
+ quotas = self.shares_v2_client.detail_quotas(**quota_args)
+ self.assertNotIn('share_replicas', quotas.keys())
+ self.assertNotIn('replica_gigabytes', quotas.keys())
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index a71449e..3215641 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -28,11 +28,10 @@
_MIN_SUPPORTED_MICROVERSION = '2.11'
-class ReplicationNegativeTest(base.BaseSharesMixedTest):
-
+class ReplicationNegativeBase(base.BaseSharesMixedTest):
@classmethod
def skip_checks(cls):
- super(ReplicationNegativeTest, cls).skip_checks()
+ super(ReplicationNegativeBase, cls).skip_checks()
if not CONF.share.run_replication_tests:
raise cls.skipException('Replication tests are disabled.')
@@ -40,7 +39,7 @@
@classmethod
def resource_setup(cls):
- super(ReplicationNegativeTest, cls).resource_setup()
+ super(ReplicationNegativeBase, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
cls.multitenancy_enabled = (
@@ -80,6 +79,9 @@
instance_id = share_instances[0]["id"]
return share, instance_id
+
+class ReplicationNegativeTest(ReplicationNegativeBase):
+
def _is_replication_type_promotable(self):
if (self.replication_type
not in constants.REPLICATION_PROMOTION_CHOICES):
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 2ea623d..b22a5c1 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -23,6 +23,7 @@
CONF = config.CONF
SHARE_NETWORK_SUBNETS_MICROVERSION = '2.51'
+SHARE_REPLICA_QUOTAS_MICROVERSION = "2.53"
def get_microversion_as_tuple(microversion_str):
@@ -202,6 +203,10 @@
return is_microversion_supported(SHARE_NETWORK_SUBNETS_MICROVERSION)
+def share_replica_quotas_are_supported():
+ return is_microversion_supported(SHARE_REPLICA_QUOTAS_MICROVERSION)
+
+
def share_network_get_default_subnet(share_network):
return next((
subnet for subnet in share_network.get('share_network_subnets', [])