Add new exception InvalidAPIVersionRange for microversion

If API version range is invalid, means min version is greater
than max version, InvalidConfiguration exception was raised.
which seems not much appropriate for utils functions as those
will be migrated to lib.

Adding new excpetion InvalidAPIVersionRange and use that instead
of InvalidConfiguration.

Partially implements blueprint api-microversions-testing-support

Change-Id: Ifb6193bfc252a3343664953aaf2caae85ab50591
This commit is contained in:
Ghanshyam 2016-02-02 10:53:33 +09:00
parent 43e8465200
commit d2e7a0afba
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)