Currently compute limits and migration client returns Response by removing top key from Response. For example- return service_client.ResponseBody(resp, body['limits']) As service clients are in direction to move to Tempest-lib, all service clients should return Response without any truncation. One good example is Resource pagination links which are lost with current way of return value. Resource pagination links are present in parallel (not inside) to top key of Response. This patch makes compute limits and migration client to return complete Response body. Change-Id: Ice3665e91ff34409f6f105303213303d1fca1816 Implements: blueprint method-return-value-and-move-service-clients-to-lib
47 lines
2.0 KiB
Python
47 lines
2.0 KiB
Python
# Copyright 2012 OpenStack Foundation
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from tempest.api.compute import base
|
|
from tempest import test
|
|
|
|
|
|
class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
|
|
|
|
@classmethod
|
|
def setup_clients(cls):
|
|
super(AbsoluteLimitsTestJSON, cls).setup_clients()
|
|
cls.client = cls.limits_client
|
|
|
|
@test.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
|
|
def test_absLimits_get(self):
|
|
# To check if all limits are present in the response
|
|
limits = self.client.show_limits()['limits']
|
|
absolute_limits = limits['absolute']
|
|
expected_elements = ['maxImageMeta', 'maxPersonality',
|
|
'maxPersonalitySize',
|
|
'maxServerMeta', 'maxTotalCores',
|
|
'maxTotalFloatingIps', 'maxSecurityGroups',
|
|
'maxSecurityGroupRules', 'maxTotalInstances',
|
|
'maxTotalKeypairs', 'maxTotalRAMSize',
|
|
'totalCoresUsed', 'totalFloatingIpsUsed',
|
|
'totalSecurityGroupsUsed', 'totalInstancesUsed',
|
|
'totalRAMUsed']
|
|
# check whether all expected elements exist
|
|
missing_elements =\
|
|
[ele for ele in expected_elements if ele not in absolute_limits]
|
|
self.assertEqual(0, len(missing_elements),
|
|
"Failed to find element %s in absolute limits list"
|
|
% ', '.join(ele for ele in missing_elements))
|