Merge "Replace StrictVersion in upgrade tests"

This commit is contained in:
Jenkins 2016-08-25 13:39:00 +00:00 committed by Gerrit Code Review
commit 033c82f7fb
2 changed files with 12 additions and 13 deletions

View File

@ -19,7 +19,6 @@ import os
# pylint: disable=import-error
# pylint: disable=no-name-in-module
from distutils.version import LooseVersion
from distutils.version import StrictVersion
# pylint: enable=no-name-in-module
# pylint: enable=import-error
@ -107,7 +106,7 @@ class DataDrivenUpgradeBase(TestBasic):
@property
def fuel_version(self):
version = self.fuel_web.client.get_api_version()['release']
return StrictVersion(version)
return LooseVersion(version)
@property
def repos_local_path(self):
@ -186,7 +185,7 @@ class DataDrivenUpgradeBase(TestBasic):
self.admin_remote.check_call(
"rm -rf /usr/lib/python2.*/site-packages/octane",
raise_on_err=False)
if LooseVersion(self.fuel_version) >= LooseVersion("9.0"):
if self.fuel_version >= LooseVersion("9.0"):
self.admin_remote.check_call(
"yum remove -y fuel-nailgun-extension-cluster-upgrade",
raise_on_err=False)
@ -312,12 +311,12 @@ class DataDrivenUpgradeBase(TestBasic):
logger.info("Applying backup from {}".format(repos_backup_path))
self.octane_action("repo-restore", repos_backup_path)
if self.fuel_version in (StrictVersion('7.0'), StrictVersion('8.0')):
if self.fuel_version in (LooseVersion('7.0'), LooseVersion('8.0')):
logger.info(
"Update CentOS bootstrap image with restored ssh keys")
self.octane_action('update-bootstrap-centos')
if self.fuel_version >= StrictVersion('8.0'):
if self.fuel_version >= LooseVersion('8.0'):
self.fuel_web.change_default_network_settings()
n_nodes = self.fuel_web.client.list_nodes()
@ -423,7 +422,7 @@ class DataDrivenUpgradeBase(TestBasic):
cmd = 'bash -c "cobbler system list" | grep ' \
'-w "node-{0}"'.format(node_id)
if self.fuel_version <= StrictVersion('8.0'):
if self.fuel_version <= LooseVersion('8.0'):
cmd = "dockerctl shell cobbler {}".format(cmd)
admin_remote.check_call(cmd)

View File

@ -16,7 +16,7 @@ from __future__ import unicode_literals
# pylint: disable=import-error
# pylint: disable=no-name-in-module
from distutils.version import StrictVersion
from distutils.version import LooseVersion
# pylint: enable=no-name-in-module
# pylint: enable=import-error
import os
@ -85,11 +85,11 @@ class UpgradeCustom(DataDrivenUpgradeBase):
self.revert_source()
assert_equal(
StrictVersion(current_step['fuel_version']),
LooseVersion(current_step['fuel_version']),
self.fuel_version,
"Wrong fuel version in current step; "
"should be {!r}, actual {!r}".format(
StrictVersion(current_step['fuel_version']),
LooseVersion(current_step['fuel_version']),
self.fuel_version))
# clean up existing files for avoiding "No space left"
self.env.d_env.get_admin_remote().check_call(
@ -126,11 +126,11 @@ class UpgradeCustom(DataDrivenUpgradeBase):
self.revert_backup()
assert_equal(
StrictVersion(current_step['source_fuel_version']),
LooseVersion(current_step['source_fuel_version']),
self.fuel_version,
"Wrong fuel version in current step; "
"should be {!r}, actual {!r}".format(
StrictVersion(current_step['source_fuel_version']),
LooseVersion(current_step['source_fuel_version']),
self.fuel_version))
assert_true(os.path.exists(self.repos_local_path))
@ -150,11 +150,11 @@ class UpgradeCustom(DataDrivenUpgradeBase):
self.do_restore(self.backup_path, self.local_path,
self.repos_backup_path, self.repos_local_path)
assert_equal(
StrictVersion(current_step['target_fuel_version']),
LooseVersion(current_step['target_fuel_version']),
self.fuel_version,
"Wrong fuel version in current step; "
"should be {!r}, actual {!r}".format(
StrictVersion(current_step['target_fuel_version']),
LooseVersion(current_step['target_fuel_version']),
self.fuel_version))
self.env.make_snapshot(self.restore_snapshot_name, is_make=True)