Publish recent api changes as v2.2

Throughout the Havana development cycle, we have added several
features to the v2 api, without breaking backwards compatibility.
So this change bumps up our minor version number.

Change-Id: If0e5ffe117200fbfb967c8c95a63608f12dbba58
(cherry picked from commit 249f800de1)
This commit is contained in:
Mark J. Washenberger 2013-09-04 14:55:08 -07:00
parent c6e06eb0b3
commit ef64e0a29c
5 changed files with 40 additions and 8 deletions

View File

@ -83,7 +83,7 @@ class VersionNegotiationFilter(wsgi.Middleware):
"""
if subject in ('v1', 'v1.0', 'v1.1') and CONF.enable_v1_api:
major_version = 1
elif subject in ('v2', 'v2.0', 'v2.1') and CONF.enable_v2_api:
elif subject in ('v2', 'v2.0', 'v2.1', 'v2.2') and CONF.enable_v2_api:
major_version = 2
else:
raise ValueError()

View File

@ -48,7 +48,8 @@ class Controller(object):
version_objs = []
if CONF.enable_v2_api:
version_objs.extend([
build_version_object(2.1, 'v2', 'CURRENT'),
build_version_object(2.2, 'v2', 'CURRENT'),
build_version_object(2.1, 'v2', 'SUPPORTED'),
build_version_object(2.0, 'v2', 'SUPPORTED'),
])
if CONF.enable_v1_api:

View File

@ -35,10 +35,15 @@ class TestRootApi(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.1',
'id': 'v2.2',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.1',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.0',
'status': 'SUPPORTED',
@ -74,10 +79,15 @@ class TestRootApi(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.1',
'id': 'v2.2',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.1',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.0',
'status': 'SUPPORTED',
@ -132,10 +142,15 @@ class TestRootApi(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.1',
'id': 'v2.2',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.1',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.0',
'status': 'SUPPORTED',

View File

@ -470,8 +470,13 @@ class TestSSL(functional.FunctionalTest):
self.start_servers(**self.__dict__.copy())
versions = {'versions': [{
"id": "v2.1",
"id": "v2.2",
"status": "CURRENT",
"links": [{
"rel": "self",
"href": "https://127.0.0.1:%d/v2/" % self.api_port}]}, {
"id": "v2.1",
"status": "SUPPORTED",
"links": [{
"rel": "self",
"href": "https://127.0.0.1:%d/v2/" % self.api_port}]}, {

View File

@ -38,11 +38,17 @@ class VersionsTest(base.IsolatedUnitTest):
results = json.loads(res.body)['versions']
expected = [
{
'id': 'v2.1',
'id': 'v2.2',
'status': 'CURRENT',
'links': [{'rel': 'self',
'href': 'http://127.0.0.1:9292/v2/'}],
},
{
'id': 'v2.1',
'status': 'SUPPORTED',
'links': [{'rel': 'self',
'href': 'http://127.0.0.1:9292/v2/'}],
},
{
'id': 'v2.0',
'status': 'SUPPORTED',
@ -107,8 +113,13 @@ class VersionNegotiationTest(base.IsolatedUnitTest):
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_2_unsupported(self):
def test_request_url_v2_2(self):
request = webob.Request.blank('/v2.2/images')
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_3_unsupported(self):
request = webob.Request.blank('/v2.3/images')
resp = self.middleware.process_request(request)
self.assertTrue(isinstance(resp, versions.Controller))