Remove key 'absolute' from limits client
limits client should be just for getting a resource "limits", it is not necessary to specify key 'absolute' at all as the library method. In addition, this patch removes get_specific_absolute_limit because the method was just wrapper. That should be implemented on test side. Change-Id: I5c0ffc136939d0aeb8574c180353715f2a0e2665
This commit is contained in:
committed by
Ken'ichi Ohmichi
parent
c2230b62f0
commit
b93e67690c
@@ -27,7 +27,8 @@ class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
|
||||
@test.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
|
||||
def test_absLimits_get(self):
|
||||
# To check if all limits are present in the response
|
||||
absolute_limits = self.client.show_limits()
|
||||
limits = self.client.show_limits()
|
||||
absolute_limits = limits['absolute']
|
||||
expected_elements = ['maxImageMeta', 'maxPersonality',
|
||||
'maxPersonalitySize',
|
||||
'maxServerMeta', 'maxTotalCores',
|
||||
|
||||
@@ -38,7 +38,8 @@ class AbsoluteLimitsNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
def test_max_image_meta_exceed_limit(self):
|
||||
# We should not create vm with image meta over maxImageMeta limit
|
||||
# Get max limit value
|
||||
max_meta = self.client.get_specific_absolute_limit('maxImageMeta')
|
||||
limits = self.client.show_limits()
|
||||
max_meta = limits['absolute']['maxImageMeta']
|
||||
|
||||
# No point in running this test if there is no limit.
|
||||
if int(max_meta) == -1:
|
||||
|
||||
@@ -34,8 +34,8 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
|
||||
# number of files are injected into the server.
|
||||
file_contents = 'This is a test file.'
|
||||
personality = []
|
||||
max_file_limit = \
|
||||
self.user_client.get_specific_absolute_limit("maxPersonality")
|
||||
limits = self.user_client.show_limits()
|
||||
max_file_limit = limits['absolute']['maxPersonality']
|
||||
if max_file_limit == -1:
|
||||
raise self.skipException("No limit for personality files")
|
||||
for i in range(0, int(max_file_limit) + 1):
|
||||
@@ -52,8 +52,8 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
|
||||
# Server should be created successfully if maximum allowed number of
|
||||
# files is injected into the server during creation.
|
||||
file_contents = 'This is a test file.'
|
||||
max_file_limit = \
|
||||
self.user_client.get_specific_absolute_limit("maxPersonality")
|
||||
limits = self.user_client.show_limits()
|
||||
max_file_limit = limits['absolute']['maxPersonality']
|
||||
if max_file_limit == -1:
|
||||
raise self.skipException("No limit for personality files")
|
||||
person = []
|
||||
|
||||
@@ -378,7 +378,7 @@ class NovaQuotaService(BaseService):
|
||||
def dry_run(self):
|
||||
client = self.limits_client
|
||||
quotas = client.show_limits()
|
||||
self.data['compute_quotas'] = quotas
|
||||
self.data['compute_quotas'] = quotas['absolute']
|
||||
|
||||
|
||||
# Begin network service classes
|
||||
|
||||
@@ -25,13 +25,4 @@ class LimitsClientJSON(service_client.ServiceClient):
|
||||
resp, body = self.get("limits")
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_limit, resp, body)
|
||||
return service_client.ResponseBody(resp, body['limits']['absolute'])
|
||||
|
||||
def get_specific_absolute_limit(self, absolute_limit):
|
||||
resp, body = self.get("limits")
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_limit, resp, body)
|
||||
if absolute_limit not in body['limits']['absolute']:
|
||||
return None
|
||||
else:
|
||||
return body['limits']['absolute'][absolute_limit]
|
||||
return service_client.ResponseBody(resp, body['limits'])
|
||||
|
||||
Reference in New Issue
Block a user