Merge "Add the ability to check the tenant quota in detail"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 7d7f3fb..1cd553e 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.24",
+ default="2.25",
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 de8c62e..cbc26b5 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -785,6 +785,17 @@
self.expected_success(202, resp.status)
return body
+ def detail_quotas(self, tenant_id, user_id=None, url=None,
+ version=LATEST_MICROVERSION):
+ if url is None:
+ url = self._get_quotas_url(version)
+ url += '/%s/detail' % tenant_id
+ if user_id is not None:
+ url += "?user_id=%s" % user_id
+ resp, body = self.get(url, version=version)
+ self.expected_success(200, resp.status)
+ return self._parse_resp(body)
+
def update_quotas(self, tenant_id, user_id=None, shares=None,
snapshots=None, gigabytes=None, snapshot_gigabytes=None,
share_networks=None, force=True, url=None,
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 d6c47e5..b8557e1 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -203,3 +203,15 @@
self.shares_v2_client.tenant_id,
version=version, url=url,
)
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+ def test_show_quota_detail_with_wrong_versions(self):
+ version = '2.24'
+ url = 'quota-sets'
+
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.shares_v2_client.detail_quotas,
+ self.shares_v2_client.tenant_id,
+ version=version, url=url,
+ )
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index e9f5042..a7540ed 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -64,3 +64,28 @@
self.assertGreater(int(quotas["shares"]), -2)
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported("2.25")
+ def test_show_quotas_detail(self):
+ quotas = self.shares_v2_client.detail_quotas(self.tenant_id)
+ quota_keys = list(quotas.keys())
+ for outer in ('gigabytes', 'snapshot_gigabytes', 'shares',
+ 'snapshots', 'share_networks'):
+ self.assertIn(outer, quota_keys)
+ for inner in ('in_use', 'limit', 'reserved'):
+ self.assertIn(inner, list(quotas[outer].keys()))
+ self.assertGreater(int(quotas[outer][inner]), -2)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+ @base.skip_if_microversion_not_supported("2.25")
+ def test_show_quotas_detail_for_user(self):
+ quotas = self.shares_v2_client.detail_quotas(self.tenant_id,
+ self.user_id)
+ quota_keys = list(quotas.keys())
+ for outer in ('gigabytes', 'snapshot_gigabytes', 'shares',
+ 'snapshots', 'share_networks'):
+ self.assertIn(outer, quota_keys)
+ for inner in ('in_use', 'limit', 'reserved'):
+ self.assertIn(inner, list(quotas[outer].keys()))
+ self.assertGreater(int(quotas[outer][inner]), -2)