Merge "Add new exception InvalidAPIVersionRange for microversion"

This commit is contained in:
Jenkins 2016-02-04 15:59:09 +00:00 committed by Gerrit Code Review
commit 6ce9ef6d8a
4 changed files with 11 additions and 7 deletions

View File

@ -38,13 +38,13 @@ def check_skip_with_microversion(test_min_version, test_max_version,
config_max_version = api_version_request.APIVersionRequest(cfg_max_version)
if ((min_version > max_version) or
(config_min_version > config_max_version)):
msg = ("Min version is greater than Max version. Test Class versions "
"[%s - %s]. configuration versions [%s - %s]."
msg = ("Test Class versions [%s - %s]. "
"Configuration versions [%s - %s]."
% (min_version.get_string(),
max_version.get_string(),
config_min_version.get_string(),
config_max_version.get_string()))
raise exceptions.InvalidConfiguration(msg)
raise exceptions.InvalidAPIVersionRange(msg)
# NOTE: Select tests which are in range of configuration like
# config min config max

View File

@ -186,6 +186,10 @@ class JSONSchemaNotFound(TempestException):
" %(schema_versions_info)s")
class InvalidAPIVersionRange(TempestException):
message = ("API Min Version is greater than Max version")
class CommandFailed(Exception):
def __init__(self, returncode, cmd, output, stderr):
super(CommandFailed, self).__init__()

View File

@ -51,11 +51,11 @@ class TestVersionSkipLogic(base.TestCase):
self._test_version('2.8', '2.9', '2.3', '2.7', expected_skip=True)
def test_version_min_greater_than_max(self):
self.assertRaises(exceptions.InvalidConfiguration,
self.assertRaises(exceptions.InvalidAPIVersionRange,
self._test_version, '2.8', '2.7', '2.3', '2.7')
def test_cfg_version_min_greater_than_max(self):
self.assertRaises(exceptions.InvalidConfiguration,
self.assertRaises(exceptions.InvalidAPIVersionRange,
self._test_version, '2.2', '2.7', '2.9', '2.7')

View File

@ -141,7 +141,7 @@ class TestMicroversionsTestsClass(base.TestCase):
'2.5', group='compute-feature-enabled')
cfg.CONF.set_default('max_microversion',
'2.1', group='compute-feature-enabled')
self.assertRaises(exceptions.InvalidConfiguration,
self.assertRaises(exceptions.InvalidAPIVersionRange,
VersionTestNoneTolatest.skip_checks)
def test_config_version_invalid_test_version(self):
@ -149,5 +149,5 @@ class TestMicroversionsTestsClass(base.TestCase):
None, group='compute-feature-enabled')
cfg.CONF.set_default('max_microversion',
'2.13', group='compute-feature-enabled')
self.assertRaises(exceptions.InvalidConfiguration,
self.assertRaises(exceptions.InvalidAPIVersionRange,
InvalidVersionTest.skip_checks)