tripleo-ci/scripts/emit_releases_file/test_release_file.py
Sofer Athlan-Guyot f3702f4335 Add standalone upgrade to emit release.
This also add dlrn_hash_newest variable to be able to make proper repo
switching.

The $title is just adding the necessary bits into emit_release to take
standalone_upgrade into account.

The dlrn_hash_newest is a forgotten variable from the initial emit
release.  It has been included for standalone upgrade where the
problem first appeared, but will likely be needed for other upgrade
jobs as well when they switch to non specific release file.

Currently we only set dlrn_hash which becomes TRIPLEO_DLRN_REPO which
becomes delorean url. We don't do anything about dlrn_hash_tag_newest
which becomes RDO_DLRN_REPO which becomes delorean-current.

This means that when we are upgrading we get the dlrn_hash_tag_newest
that was defined in the previous run, ie during deployment.

Change-Id: I0e298fc37eb7b3fd0afaa13ab021330b789b2f5e
Closes-Bug: #1795367
2018-10-24 00:18:40 +02:00

148 lines
6.5 KiB
Python

from emit_releases_file import shim_convert_old_release_names
def test_converting_from_oc_upgrade_has_double_release():
releases_name = {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'queens',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'master-undercloud-queens-overcloud',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master-undercloud-queens-overcloud',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master-undercloud-queens-overcloud',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master-undercloud-queens-overcloud',
'overcloud_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=False) ==
expected_releases_file)
# Also periodic jobs use the same release files
assert (shim_convert_old_release_names(releases_name, is_periodic=True) ==
expected_releases_file)
def test_converting_from_uc_upgrade_has_single_release():
releases_name = {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=False) ==
expected_releases_file)
def test_converting_from_periodic_uc_upgrade_has_single_release_with_sufix():
releases_name = {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'promotion-testing-hash-queens',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'promotion-testing-hash-master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'promotion-testing-hash-master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'promotion-testing-hash-master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'promotion-testing-hash-rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'promotion-testing-hash-master',
'standalone_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=True) ==
expected_releases_file)
def test_converting_from_noop_has_single_release():
releases_name = {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=False) ==
expected_releases_file)
def test_converting_from_periodic_noop_has_single_release_with_sufix():
releases_name = {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'promotion-testing-hash-master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'promotion-testing-hash-master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'promotion-testing-hash-master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'promotion-testing-hash-master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'promotion-testing-hash-rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'promotion-testing-hash-master',
'standalone_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=True) ==
expected_releases_file)