Use predictable step detection in upgrade custom tool
Right now the tool does not working from the middle after re-launch. We have to specify the step for each run of tests Change-Id: I7203b597c8320d68b5cd412e99c84dfb29249ba5
This commit is contained in:
parent
c3b978c681
commit
4044dc1530
@ -421,8 +421,9 @@ MAKE_SNAPSHOT = get_var_as_bool('MAKE_SNAPSHOT', False)
|
|||||||
|
|
||||||
FUEL_SETTINGS_YAML = os.environ.get('FUEL_SETTINGS_YAML',
|
FUEL_SETTINGS_YAML = os.environ.get('FUEL_SETTINGS_YAML',
|
||||||
'/etc/fuel/astute.yaml')
|
'/etc/fuel/astute.yaml')
|
||||||
|
# Upgrade-related variables
|
||||||
UPGRADE_TEST_TEMPLATE = os.environ.get("UPGRADE_TEST_TEMPLATE")
|
UPGRADE_TEST_TEMPLATE = os.environ.get("UPGRADE_TEST_TEMPLATE")
|
||||||
|
UPGRADE_CUSTOM_STEP_NAME = os.environ.get("UPGRADE_CUSTOM_STEP_NAME", "")
|
||||||
TARBALL_PATH = os.environ.get('TARBALL_PATH')
|
TARBALL_PATH = os.environ.get('TARBALL_PATH')
|
||||||
|
|
||||||
UPGRADE_FUEL_FROM = os.environ.get('UPGRADE_FUEL_FROM', '8.0')
|
UPGRADE_FUEL_FROM = os.environ.get('UPGRADE_FUEL_FROM', '8.0')
|
||||||
@ -435,6 +436,7 @@ UPGRADE_BACKUP_FILES_LOCAL_DIR = os.environ.get(
|
|||||||
os.path.curdir, "..", "backup_storage"))
|
os.path.curdir, "..", "backup_storage"))
|
||||||
UPGRADE_BACKUP_FILES_REMOTE_DIR = os.environ.get(
|
UPGRADE_BACKUP_FILES_REMOTE_DIR = os.environ.get(
|
||||||
'UPGRADE_BACKUP_FILES_REMOTE_DIR', "/var/upgrade/backups")
|
'UPGRADE_BACKUP_FILES_REMOTE_DIR', "/var/upgrade/backups")
|
||||||
|
# End of upgrade-related variables
|
||||||
|
|
||||||
SNAPSHOT = os.environ.get('SNAPSHOT', '')
|
SNAPSHOT = os.environ.get('SNAPSHOT', '')
|
||||||
# For 5.1.1 we have 2 releases in tarball and should specify what we need
|
# For 5.1.1 we have 2 releases in tarball and should specify what we need
|
||||||
|
@ -23,7 +23,7 @@ import os
|
|||||||
|
|
||||||
from devops.helpers.templates import yaml_template_load
|
from devops.helpers.templates import yaml_template_load
|
||||||
from proboscis import test, SkipTest
|
from proboscis import test, SkipTest
|
||||||
from proboscis.asserts import assert_true, assert_equal
|
from proboscis.asserts import assert_true, assert_equal, fail
|
||||||
|
|
||||||
from fuelweb_test import settings, logger
|
from fuelweb_test import settings, logger
|
||||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||||
@ -45,19 +45,20 @@ class UpgradeCustom(DataDrivenUpgradeBase):
|
|||||||
["{}:{}".format(key, value) for key, value in step.items()]))
|
["{}:{}".format(key, value) for key, value in step.items()]))
|
||||||
|
|
||||||
def _get_current_step(self):
|
def _get_current_step(self):
|
||||||
|
step_name = settings.UPGRADE_CUSTOM_STEP_NAME
|
||||||
|
target_field = {'backup': 'backup_snapshot_name',
|
||||||
|
'restore': 'restore_snapshot_name'}
|
||||||
for item in self.upgrade_data:
|
for item in self.upgrade_data:
|
||||||
if item['action'] == 'backup':
|
if not step_name == item['name']:
|
||||||
if self.env.d_env.has_snapshot(item['backup_snapshot_name']):
|
continue
|
||||||
continue
|
if self.env.d_env.has_snapshot(
|
||||||
else:
|
item[target_field[item['action']]]):
|
||||||
return item
|
raise SkipTest(
|
||||||
elif item['action'] == 'restore':
|
"Step {!r} already executed".format(step_name))
|
||||||
if self.env.d_env.has_snapshot(item['restore_snapshot_name']):
|
else:
|
||||||
continue
|
return item
|
||||||
else:
|
fail("Can not find step {!r} in config file {!r}".format(
|
||||||
return item
|
step_name, settings.UPGRADE_TEST_TEMPLATE))
|
||||||
raise SkipTest("All steps are executed, all snapshots are exists; "
|
|
||||||
"Nothing to do")
|
|
||||||
|
|
||||||
@test(groups=['upgrade_custom_backup'])
|
@test(groups=['upgrade_custom_backup'])
|
||||||
@log_snapshot_after_test
|
@log_snapshot_after_test
|
||||||
|
Loading…
Reference in New Issue
Block a user