Merge "Bump up Glance API minor version to 2.4"

This commit is contained in:
Jenkins 2016-09-15 18:12:27 +00:00 committed by Gerrit Code Review
commit dbfe9377e1
4 changed files with 55 additions and 9 deletions

View File

@ -83,6 +83,7 @@ class VersionNegotiationFilter(wsgi.Middleware):
allowed_versions['v2.1'] = 2
allowed_versions['v2.2'] = 2
allowed_versions['v2.3'] = 2
allowed_versions['v2.4'] = 2
return allowed_versions
def _match_version_string(self, subject):

View File

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

View File

@ -32,10 +32,15 @@ class TestApiVersions(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -79,10 +84,15 @@ class TestApiVersions(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -144,10 +154,15 @@ class TestApiPaths(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',

View File

@ -36,11 +36,17 @@ class VersionsTest(base.IsolatedUnitTest):
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self',
'href': 'http://127.0.0.1:9292/v2/'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self',
'href': 'http://127.0.0.1:9292/v2/'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -85,11 +91,17 @@ class VersionsTest(base.IsolatedUnitTest):
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self',
'href': 'https://example.com:9292/v2/'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self',
'href': 'https://example.com:9292/v2/'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -133,11 +145,17 @@ class VersionsTest(base.IsolatedUnitTest):
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self',
'href': 'http://localhost:9292/v2/'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self',
'href': 'http://localhost:9292/v2/'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -182,11 +200,17 @@ class VersionsTest(base.IsolatedUnitTest):
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.3',
'id': 'v2.4',
'status': 'CURRENT',
'links': [{'rel': 'self',
'href': 'https://localhost:9292/v2/'}],
},
{
'id': 'v2.3',
'status': 'SUPPORTED',
'links': [{'rel': 'self',
'href': 'https://localhost:9292/v2/'}],
},
{
'id': 'v2.2',
'status': 'SUPPORTED',
@ -273,8 +297,13 @@ class VersionNegotiationTest(base.IsolatedUnitTest):
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_4_unsupported(self):
def test_request_url_v2_4(self):
request = webob.Request.blank('/v2.4/images')
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_5_unsupported(self):
request = webob.Request.blank('/v2.5/images')
resp = self.middleware.process_request(request)
self.assertIsInstance(resp, versions.Controller)