Filter deprecated versions out

* api_v2 version of volume service and api_v1 version
  of image service are deprecated, but were discovered
  and set to True.
* The patch fixes that by checking the status of the
  version.
* The patch also adds a deprecated version to fake
  services, which are used by unit tests.
* For backward compatibility of python-tempestconf with
  older relesies of OpenStack, the patch doesn't remove
  deprecated versions (they're not deprecated in Pike
  and older)

Change-Id: I88312d6425ad7bdc132b9b6dbe03c0c07349515c
This commit is contained in:
Martin Kopec 2018-05-15 16:55:24 +00:00
parent f13dfbfe07
commit 6e2bf36c2b
3 changed files with 24 additions and 1 deletions

View File

@ -50,6 +50,12 @@ SERVICE_NAMES = {
# depending on whether they get discovered as supported. Services with only one
# version don't need to be here, neither do service versions that are not
# configurable in tempest.conf
# TODO(mkopec) since Queens, there are only image v2, identity v3 and
# volume v3 versions, however, for backward compatibility let's keep
# all versions here
# TODO(mkopec) Move this information about supported versions somewhere else,
# so that we don't have to have this global object, for example move the
# information to service classes
SERVICE_VERSIONS = {
'image': {'supported_versions': ['v1', 'v2'], 'catalog': 'image'},
'identity': {'supported_versions': ['v2', 'v3'], 'catalog': 'identity'},

View File

@ -83,7 +83,11 @@ class VersionedService(Service):
self.versions = self.deserialize_versions(body)
def deserialize_versions(self, body):
return map(lambda x: x['id'], body['versions'])
versions = []
for version in body['versions']:
if version['status'] != "DEPRECATED":
versions.append(version)
return map(lambda x: x['id'], versions)
def no_port_cut_url(self):
# if there is no port defined, cut the url from version to the end

View File

@ -116,6 +116,19 @@ class BaseServiceTest(base.BaseTestCase):
"values": [
{"id": 'v2.0'}
]
}, {
"status": "DEPRECATED",
"updated": "2013-07-23T11:33:21Z",
"links": [{
"href": "http://10.200.16.10:8774/v1/",
"rel": "self"
}],
"min_version": "1.0",
"version": "1.0",
"id": "v1.0",
"values": [
{"id": 'v1.0'}
]
}]
}
)