Merge "Add test ensure all the microversions are sequential in placement API"

This commit is contained in:
Jenkins 2017-06-02 03:47:47 +00:00 committed by Gerrit Code Review
commit 83f4906c72

View File

@ -156,3 +156,18 @@ class TestMicroversionUtility(test.NoDBTestCase):
self.assertRaises(KeyError,
microversion.raise_http_status_code_if_not_version,
self.req, 999, '1.5')
class MicroversionSequentialTest(test.NoDBTestCase):
def test_microversion_sequential(self):
for method_name, method_list in microversion.VERSIONED_METHODS.items():
previous_min_version = method_list[0][0]
for method in method_list[1:]:
previous_min_version = microversion.parse_version_string(
'%s.%s' % (previous_min_version.major,
previous_min_version.minor - 1))
self.assertEqual(previous_min_version, method[1],
"The microversions aren't sequential in the mehtod %s" %
method_name)
previous_min_version = method[0]