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:
Vladimir Khlyunev 2016-08-19 19:00:25 +03:00
parent c3b978c681
commit 4044dc1530
2 changed files with 17 additions and 14 deletions

View File

@ -421,8 +421,9 @@ MAKE_SNAPSHOT = get_var_as_bool('MAKE_SNAPSHOT', False)
FUEL_SETTINGS_YAML = os.environ.get('FUEL_SETTINGS_YAML',
'/etc/fuel/astute.yaml')
# Upgrade-related variables
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')
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"))
UPGRADE_BACKUP_FILES_REMOTE_DIR = os.environ.get(
'UPGRADE_BACKUP_FILES_REMOTE_DIR', "/var/upgrade/backups")
# End of upgrade-related variables
SNAPSHOT = os.environ.get('SNAPSHOT', '')
# For 5.1.1 we have 2 releases in tarball and should specify what we need

View File

@ -23,7 +23,7 @@ import os
from devops.helpers.templates import yaml_template_load
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.helpers.decorators import log_snapshot_after_test
@ -45,19 +45,20 @@ class UpgradeCustom(DataDrivenUpgradeBase):
["{}:{}".format(key, value) for key, value in step.items()]))
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:
if item['action'] == 'backup':
if self.env.d_env.has_snapshot(item['backup_snapshot_name']):
if not step_name == item['name']:
continue
if self.env.d_env.has_snapshot(
item[target_field[item['action']]]):
raise SkipTest(
"Step {!r} already executed".format(step_name))
else:
return item
elif item['action'] == 'restore':
if self.env.d_env.has_snapshot(item['restore_snapshot_name']):
continue
else:
return item
raise SkipTest("All steps are executed, all snapshots are exists; "
"Nothing to do")
fail("Can not find step {!r} in config file {!r}".format(
step_name, settings.UPGRADE_TEST_TEMPLATE))
@test(groups=['upgrade_custom_backup'])
@log_snapshot_after_test