Merge "Replace StrictVersion in upgrade tests"
This commit is contained in:
commit
033c82f7fb
@ -19,7 +19,6 @@ import os
|
|||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
# pylint: disable=no-name-in-module
|
# pylint: disable=no-name-in-module
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
from distutils.version import StrictVersion
|
|
||||||
# pylint: enable=no-name-in-module
|
# pylint: enable=no-name-in-module
|
||||||
# pylint: enable=import-error
|
# pylint: enable=import-error
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ class DataDrivenUpgradeBase(TestBasic):
|
|||||||
@property
|
@property
|
||||||
def fuel_version(self):
|
def fuel_version(self):
|
||||||
version = self.fuel_web.client.get_api_version()['release']
|
version = self.fuel_web.client.get_api_version()['release']
|
||||||
return StrictVersion(version)
|
return LooseVersion(version)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def repos_local_path(self):
|
def repos_local_path(self):
|
||||||
@ -186,7 +185,7 @@ class DataDrivenUpgradeBase(TestBasic):
|
|||||||
self.admin_remote.check_call(
|
self.admin_remote.check_call(
|
||||||
"rm -rf /usr/lib/python2.*/site-packages/octane",
|
"rm -rf /usr/lib/python2.*/site-packages/octane",
|
||||||
raise_on_err=False)
|
raise_on_err=False)
|
||||||
if LooseVersion(self.fuel_version) >= LooseVersion("9.0"):
|
if self.fuel_version >= LooseVersion("9.0"):
|
||||||
self.admin_remote.check_call(
|
self.admin_remote.check_call(
|
||||||
"yum remove -y fuel-nailgun-extension-cluster-upgrade",
|
"yum remove -y fuel-nailgun-extension-cluster-upgrade",
|
||||||
raise_on_err=False)
|
raise_on_err=False)
|
||||||
@ -312,12 +311,12 @@ class DataDrivenUpgradeBase(TestBasic):
|
|||||||
logger.info("Applying backup from {}".format(repos_backup_path))
|
logger.info("Applying backup from {}".format(repos_backup_path))
|
||||||
self.octane_action("repo-restore", 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(
|
logger.info(
|
||||||
"Update CentOS bootstrap image with restored ssh keys")
|
"Update CentOS bootstrap image with restored ssh keys")
|
||||||
self.octane_action('update-bootstrap-centos')
|
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()
|
self.fuel_web.change_default_network_settings()
|
||||||
|
|
||||||
n_nodes = self.fuel_web.client.list_nodes()
|
n_nodes = self.fuel_web.client.list_nodes()
|
||||||
@ -423,7 +422,7 @@ class DataDrivenUpgradeBase(TestBasic):
|
|||||||
|
|
||||||
cmd = 'bash -c "cobbler system list" | grep ' \
|
cmd = 'bash -c "cobbler system list" | grep ' \
|
||||||
'-w "node-{0}"'.format(node_id)
|
'-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)
|
cmd = "dockerctl shell cobbler {}".format(cmd)
|
||||||
admin_remote.check_call(cmd)
|
admin_remote.check_call(cmd)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
# pylint: disable=no-name-in-module
|
# pylint: disable=no-name-in-module
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import LooseVersion
|
||||||
# pylint: enable=no-name-in-module
|
# pylint: enable=no-name-in-module
|
||||||
# pylint: enable=import-error
|
# pylint: enable=import-error
|
||||||
import os
|
import os
|
||||||
@ -85,11 +85,11 @@ class UpgradeCustom(DataDrivenUpgradeBase):
|
|||||||
|
|
||||||
self.revert_source()
|
self.revert_source()
|
||||||
assert_equal(
|
assert_equal(
|
||||||
StrictVersion(current_step['fuel_version']),
|
LooseVersion(current_step['fuel_version']),
|
||||||
self.fuel_version,
|
self.fuel_version,
|
||||||
"Wrong fuel version in current step; "
|
"Wrong fuel version in current step; "
|
||||||
"should be {!r}, actual {!r}".format(
|
"should be {!r}, actual {!r}".format(
|
||||||
StrictVersion(current_step['fuel_version']),
|
LooseVersion(current_step['fuel_version']),
|
||||||
self.fuel_version))
|
self.fuel_version))
|
||||||
# clean up existing files for avoiding "No space left"
|
# clean up existing files for avoiding "No space left"
|
||||||
self.env.d_env.get_admin_remote().check_call(
|
self.env.d_env.get_admin_remote().check_call(
|
||||||
@ -126,11 +126,11 @@ class UpgradeCustom(DataDrivenUpgradeBase):
|
|||||||
self.revert_backup()
|
self.revert_backup()
|
||||||
|
|
||||||
assert_equal(
|
assert_equal(
|
||||||
StrictVersion(current_step['source_fuel_version']),
|
LooseVersion(current_step['source_fuel_version']),
|
||||||
self.fuel_version,
|
self.fuel_version,
|
||||||
"Wrong fuel version in current step; "
|
"Wrong fuel version in current step; "
|
||||||
"should be {!r}, actual {!r}".format(
|
"should be {!r}, actual {!r}".format(
|
||||||
StrictVersion(current_step['source_fuel_version']),
|
LooseVersion(current_step['source_fuel_version']),
|
||||||
self.fuel_version))
|
self.fuel_version))
|
||||||
|
|
||||||
assert_true(os.path.exists(self.repos_local_path))
|
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.do_restore(self.backup_path, self.local_path,
|
||||||
self.repos_backup_path, self.repos_local_path)
|
self.repos_backup_path, self.repos_local_path)
|
||||||
assert_equal(
|
assert_equal(
|
||||||
StrictVersion(current_step['target_fuel_version']),
|
LooseVersion(current_step['target_fuel_version']),
|
||||||
self.fuel_version,
|
self.fuel_version,
|
||||||
"Wrong fuel version in current step; "
|
"Wrong fuel version in current step; "
|
||||||
"should be {!r}, actual {!r}".format(
|
"should be {!r}, actual {!r}".format(
|
||||||
StrictVersion(current_step['target_fuel_version']),
|
LooseVersion(current_step['target_fuel_version']),
|
||||||
self.fuel_version))
|
self.fuel_version))
|
||||||
|
|
||||||
self.env.make_snapshot(self.restore_snapshot_name, is_make=True)
|
self.env.make_snapshot(self.restore_snapshot_name, is_make=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user