Fix tempest init logic

The tempest init was checking if the workspace/etc directory exists, and
were creating a new workspace without pass a name, the default is
workspace, but passing a --name ensure it won't break if tempest decides
to change it.
Also, the rename command only change the name in the
$HOME/.tempest/workspace.yml, it doesn't change the path for the
particular workspace. The same happens with the move command, it just
update the path on the workspace.yml file.
With this patch, the tempest workspace is being moved properly to a
workspace_$CURDATE, all the files are copied to the new workspace,
delete the old workspace directory, and call tempest init properly.

Also adding tripleo upgrade job as nv for now, since this issue only
happen in upgrade jobs.

Change-Id: I8a3b79352819f5e980eaea7482cd6b1f1bfc47be
Closes-Bug: #1896126
This commit is contained in:
Arx Cruz 2020-09-22 17:58:06 +02:00 committed by Jonathan Rosser
parent 5a46aff857
commit 278ef6f829
2 changed files with 14 additions and 8 deletions

View File

@ -97,15 +97,19 @@
# breakage when we are upgrade from rocky to stein as the workspace
# path has been change between these two releases
if tempest workspace list | grep ' workspace '; then
if ! tempest workspace list | grep ' workspace ' | grep -w {{ tempest_workspace }}; then
# Init not working on existing entry. Renme old workspace instead and init new.
export CURDATE=$(date +"%d%^b%g_%H%M%S%Z")
tempest workspace rename --old-name workspace --new-name workspace_${CURDATE}
tempest init {{ tempest_workspace }}
fi
# Init not working on existing entry. Renme old workspace instead and init new.
export CURDATE=$(date +"%d%^b%g_%H%M%S%Z")
WSPATH=$(dirname $(tempest workspace list | awk '{if($2 == "workspace"){print $4}}'))
tempest workspace rename --old-name workspace --new-name workspace_${CURDATE}
mv ${WSPATH}/workspace ${WSPATH}/workspace_${CURDATE}
tempest workspace move --name workspace_${CURDATE} --path ${WSPATH}/workspace_${CURDATE}/
tempest init ${CURWORKSPACE}
else
tempest init --name workspace {{ tempest_workspace }}
exit 3
fi
tempest init {{ tempest_workspace }}
exit 3
fi
args:
executable: /bin/bash

View File

@ -30,6 +30,8 @@
tox_environment:
PYTEST_REQPASS: 1
- tripleo-ci-centos-8-standalone
- tripleo-ci-centos-8-standalone-upgrade:
voting: false
gate:
jobs:
- openstack-ansible-deploy-aio_distro_metal_tempestconf-centos-8