Merge limits functional tests of v2 and v2.1
Currently v2 and v2.1 have separate functional tests and their corresponding sample files. As v2 and v2.1 are supposed to be identical, there is overhead to maintain two set of functional tests and sample files. We can have one set of tests which can run for both v2 and v2.1. This commit merges limits functional tests. There was no functional tests for limits in v2.1 V2 implied RateLimitingMiddleware while V2.1 does not have that so the response data is different between V2 and V2.1, there are more info in "rate" section in V2 than V2.1. We have to keep both of the template files. Partially implements blueprint test-collapse-v2-and-v21 Change-Id: If4fbaaeaa1819083f7f4c460216023ae8f65021d
This commit is contained in:
parent
71f41e633f
commit
451a5ff5d9
@ -1,85 +0,0 @@
|
||||
{
|
||||
"limits": {
|
||||
"absolute": {
|
||||
"maxImageMeta": 128,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxSecurityGroupRules": 20,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200
|
||||
},
|
||||
"rate": [
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "POST"
|
||||
},
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "PUT"
|
||||
},
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "DELETE"
|
||||
}
|
||||
],
|
||||
"regex": ".*",
|
||||
"uri": "*"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "POST"
|
||||
}
|
||||
],
|
||||
"regex": "^/servers",
|
||||
"uri": "*/servers"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "GET"
|
||||
}
|
||||
],
|
||||
"regex": ".*changes-since.*",
|
||||
"uri": "*changes-since*"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "2012-11-27T17:22:18Z",
|
||||
"remaining": 12,
|
||||
"unit": "MINUTE",
|
||||
"value": 12,
|
||||
"verb": "GET"
|
||||
}
|
||||
],
|
||||
"regex": "^/os-fping",
|
||||
"uri": "*/os-fping"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
20
doc/api_samples/limits/limit-get-resp.json
Normal file
20
doc/api_samples/limits/limit-get-resp.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"limits": {
|
||||
"absolute": {
|
||||
"maxImageMeta": 128,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxSecurityGroupRules": 20,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200,
|
||||
"maxServerGroups": 10,
|
||||
"maxServerGroupMembers": 10
|
||||
},
|
||||
"rate": []
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"limits": {
|
||||
"absolute": {
|
||||
"maxImageMeta": 128,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxSecurityGroupRules": 20,
|
||||
"maxServerGroups": 10,
|
||||
"maxServerGroupMembers": 10
|
||||
},
|
||||
"rate": []
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
{
|
||||
"limits": {
|
||||
"absolute": {
|
||||
"maxImageMeta": 128,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxSecurityGroupRules": 20
|
||||
},
|
||||
"rate": [
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "POST"
|
||||
},
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "PUT"
|
||||
},
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "DELETE"
|
||||
}
|
||||
],
|
||||
"regex": ".*",
|
||||
"uri": "*"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "POST"
|
||||
}
|
||||
],
|
||||
"regex": "^/servers",
|
||||
"uri": "*/servers"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 120,
|
||||
"unit": "MINUTE",
|
||||
"value": 120,
|
||||
"verb": "GET"
|
||||
}
|
||||
],
|
||||
"regex": ".*changes-since.*",
|
||||
"uri": "*changes-since*"
|
||||
},
|
||||
{
|
||||
"limit": [
|
||||
{
|
||||
"next-available": "%(isotime)s",
|
||||
"remaining": 12,
|
||||
"unit": "MINUTE",
|
||||
"value": 12,
|
||||
"verb": "GET"
|
||||
}
|
||||
],
|
||||
"regex": "^/os-fping",
|
||||
"uri": "*/os-fping"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -156,15 +156,6 @@ class ServersSampleBase(ApiSampleTestBaseV2):
|
||||
self.__class__._use_common_server_api_samples = orig_value
|
||||
|
||||
|
||||
class LimitsSampleJsonTest(ApiSampleTestBaseV2):
|
||||
sample_dir = 'limits'
|
||||
|
||||
def test_limits_get(self):
|
||||
response = self._do_get('limits')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('limit-get-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ExtendedIpsSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib"
|
||||
".extended_ips.Extended_ips")
|
||||
@ -211,9 +202,3 @@ class ExtendedIpsMacSampleJsonTests(ServersSampleBase):
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['mac_addr'] = '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
|
||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ServerGroupQuotas_LimitsSampleJsonTest(LimitsSampleJsonTest):
|
||||
sample_dir = None
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib."
|
||||
"server_group_quotas.Server_group_quotas")
|
||||
|
53
nova/tests/functional/api_sample_tests/test_limits.py
Normal file
53
nova/tests/functional/api_sample_tests/test_limits.py
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright 2012 Nebula, Inc.
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# 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 oslo_config import cfg
|
||||
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.legacy_v2.extensions')
|
||||
|
||||
|
||||
class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
ADMIN_API = True
|
||||
extension_name = "limits"
|
||||
|
||||
# TODO(gmann): Overriding '_api_version' till all functional tests
|
||||
# are merged between v2 and v2.1. After that base class variable
|
||||
# itself can be changed to 'v2'
|
||||
_api_version = 'v2'
|
||||
|
||||
def setUp(self):
|
||||
super(LimitsSampleJsonTest, self).setUp()
|
||||
# NOTE(gmann): We have to separate the template files between V2
|
||||
# and V2.1 as the response are different.
|
||||
self.template = 'limit-get-resp'
|
||||
if(self._test == "v2"):
|
||||
self.template = 'v2-limit-get-resp'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(LimitsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append("nova.api.openstack.compute."
|
||||
"legacy_v2.contrib.server_group_quotas."
|
||||
"Server_group_quotas")
|
||||
return f
|
||||
|
||||
def test_limits_get(self):
|
||||
response = self._do_get('limits')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response(self.template, subs, response, 200)
|
Loading…
x
Reference in New Issue
Block a user