Remove the legacy v2 API test scenarios from API sample tests

This patches from the test scenarios for the legacy v2 from API
sample tests. There still have some codes for legacy v2 which should
be cleanup, but that can be done later patches. This patch just stop
the test on the legacy v2 API.

Partially implements blueprint remove-legacy-v2-api-code

Change-Id: I38626e5a4aa98cbfd7b65b5eb0edbcae96e5b3f2
This commit is contained in:
He Jie Xu 2016-05-04 10:14:15 +08:00
parent 035fed4e9c
commit 73eda1cb7d
10 changed files with 4 additions and 432 deletions

View File

@ -1,10 +0,0 @@
{
"extension": {
"alias": "os-agents",
"description": "Agents support.",
"links": [],
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/agents/api/v2",
"updated": "2012-10-28T00:00:00Z"
}
}

View File

@ -1,87 +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,
"maxServerGroups": 10,
"maxServerGroupMembers": 10
},
"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"
}
]
}
}

View File

@ -1,93 +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,
"maxServerGroups": 10,
"maxServerGroupMembers": 10,
"totalCoresUsed": 0,
"totalInstancesUsed": 0,
"totalRAMUsed": 0,
"totalSecurityGroupsUsed": 0,
"totalFloatingIpsUsed": 0,
"totalServerGroupsUsed": 0
},
"rate": [
{
"limit": [
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 120,
"unit": "MINUTE",
"value": 120,
"verb": "POST"
},
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 120,
"unit": "MINUTE",
"value": 120,
"verb": "PUT"
},
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 120,
"unit": "MINUTE",
"value": 120,
"verb": "DELETE"
}
],
"regex": ".*",
"uri": "*"
},
{
"limit": [
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 120,
"unit": "MINUTE",
"value": 120,
"verb": "POST"
}
],
"regex": "^/servers",
"uri": "*/servers"
},
{
"limit": [
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 120,
"unit": "MINUTE",
"value": 120,
"verb": "GET"
}
],
"regex": ".*changes-since.*",
"uri": "*changes-since*"
},
{
"limit": [
{
"next-available": "2012-11-27T17:24:52Z",
"remaining": 12,
"unit": "MINUTE",
"value": 12,
"verb": "GET"
}
],
"regex": "^/os-fping",
"uri": "*/os-fping"
}
]
}
}

View File

@ -37,15 +37,12 @@ CONF.import_opt('osapi_compute_extension',
# the scenario (should be unique), and the second item is a dictionary
# of attributes to change in the class for the test.
#
# By default we're running scenarios for 3 situations
# By default we're running scenarios for 2 situations
#
# - Hitting the default /v2 endpoint
# - Hitting the default /v2 endpoint with the v2.1 Compatibility stack
#
# - Hitting the default /v2.1 endpoint
#
# - Hitting the /v2 but fixing the paste pipeline so that it uses the
# legacy v2 code. This requires a fixture.
#
# Things we need to set:
#
# - api_major_version - what version of the API we should be hitting
@ -54,9 +51,6 @@ CONF.import_opt('osapi_compute_extension',
#
# - _additional_fixtures - any additional fixtures need
#
# - _legacy_v2_code - True/False if we are using the legacy v2 code
# stack. Sadly, a few tests really care about this.
#
# NOTE(sdague): if you want to build a test that only tests specific
# microversions, then replace the ``scenarios`` class variable in that
# test class with something like:
@ -71,7 +65,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
_additional_fixtures = []
sample_dir = None
extra_extensions_to_load = None
_legacy_v2_code = False
_project_id = True
scenarios = [
@ -81,12 +74,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
# test v2.1 base microversion
('v2_1', {
'api_major_version': 'v2.1'}),
# test v2 with the v2 legacy code
('v2legacy', {
'api_major_version': 'v2',
'_legacy_v2_code': True,
'_additional_fixtures': [
api_paste_fixture.ApiPasteLegacyV2Fixture]}),
# test v2.18 code without project id
('v2_1_noproject_id', {
'api_major_version': 'v2.1',

View File

@ -1,10 +0,0 @@
{
"extension": {
"alias": "os-agents",
"description": "%(text)s",
"links": [],
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/agents/api/v2",
"updated": "%(isotime)s"
}
}

View File

@ -1,87 +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,
"maxServerGroups": 10,
"maxServerGroupMembers": 10
},
"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"
}
]
}
}

View File

@ -1,93 +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,
"maxServerGroups": 10,
"maxServerGroupMembers": 10,
"totalCoresUsed": 0,
"totalInstancesUsed": 0,
"totalRAMUsed": 0,
"totalSecurityGroupsUsed": 0,
"totalFloatingIpsUsed": 0,
"totalServerGroupsUsed": 0
},
"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"
}
]
}
}

View File

@ -14,15 +14,10 @@
# under the License.
import mock
from oslo_config import cfg
from nova.api.openstack import extensions as api_extensions
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')
def fake_soft_extension_authorizer(extension_name, core=False):
def authorize(context, action=None):
@ -42,10 +37,7 @@ class ExtensionInfoAllSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
# stack. We default to the v2.1 case.
template = 'extensions-list-resp'
if self.api_major_version == 'v2':
if self._legacy_v2_code:
template = 'extensions-list-resp-v2'
else:
template = 'extensions-list-resp-v21-compatible'
template = 'extensions-list-resp-v21-compatible'
self._verify_response(template, {}, response, 200)
@ -58,10 +50,4 @@ class ExtensionInfoSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
def test_get_extensions(self, soft_auth):
soft_auth.side_effect = fake_soft_extension_authorizer
response = self._do_get('extensions/os-agents')
# The extension details info are different between legacy v2 and v2.1
# stack. namespace link and updated date are different. So keep both
# version for testing and default to v2.1
template = 'extensions-get-resp'
if self._legacy_v2_code:
template = 'extensions-get-resp-v2'
self._verify_response(template, {}, response, 200)
self._verify_response('extensions-get-resp', {}, response, 200)

View File

@ -31,8 +31,6 @@ class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
# 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._legacy_v2_code:
self.template = 'v2-limit-get-resp'
def _get_flags(self):
f = super(LimitsSampleJsonTest, self)._get_flags()

View File

@ -32,25 +32,6 @@ class UsedLimitsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
# NOTE(park): We have to separate the template files between V2
# and V2.1 as the response are different.
self.template = 'usedlimits-get-resp'
if self._legacy_v2_code:
self.template = 'v2-usedlimits-get-resp'
def _get_flags(self):
f = super(UsedLimitsSamplesJsonTest, self)._get_flags()
if self._legacy_v2_code:
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")
f['osapi_compute_extension'].append(
"nova.api.openstack.compute."
"legacy_v2.contrib.used_limits.Used_limits")
f['osapi_compute_extension'].append(
"nova.api.openstack.compute."
"legacy_v2.contrib.used_limits_for_admin."
"Used_limits_for_admin")
return f
def test_get_used_limits(self):
# Get api sample to used limits.