Add centos9 support for emit_releases_script
emit_releases_file needed to be updated to support centos9 and integration pipeline. The tests have been only partially updated: added the success scenario to cover the centos9 case. Change-Id: I4e35a0ce1c7b38a7e354c4571ac6a005697632d7
This commit is contained in:
parent
041d6c22c8
commit
a4e789cbfe
|
@ -110,8 +110,13 @@ def get_dlrn_hash(
|
|||
logger.error("distro %s version %s", distro_name, distro_version)
|
||||
if distro_name == 'centos' and distro_version == '7':
|
||||
repo_url = '%s/centos7-%s/%s/delorean.repo' % (rdo_url, release, hash_name)
|
||||
elif distro_name == 'centos' and distro_version == '8':
|
||||
repo_url = '%s/centos8-%s/%s/delorean.repo.md5' % (rdo_url, release, hash_name)
|
||||
elif distro_name == 'centos' and distro_version in ['8', '9']:
|
||||
repo_url = '%s/centos%s-%s/%s/delorean.repo.md5' % (
|
||||
rdo_url,
|
||||
distro_version,
|
||||
release,
|
||||
hash_name,
|
||||
)
|
||||
logger.debug(
|
||||
"distro_name {} distro_version {} repo_url {}"
|
||||
"".format(distro_name, distro_version, repo_url)
|
||||
|
@ -131,7 +136,7 @@ def get_dlrn_hash(
|
|||
if distro_name == 'centos' and distro_version == '7':
|
||||
print(repo_file.text)
|
||||
full_hash = full_hash_pattern.findall(repo_file.text)[0]
|
||||
elif distro_name == 'centos' and distro_version == '8':
|
||||
elif distro_name == 'centos' and distro_version in ['8', '9']:
|
||||
full_hash = repo_file.text
|
||||
break
|
||||
|
||||
|
@ -435,7 +440,7 @@ if __name__ == '__main__':
|
|||
)
|
||||
parser.add_argument(
|
||||
'--distro-version',
|
||||
choices=['7', '8'],
|
||||
choices=['7', '8', '9'],
|
||||
required=True,
|
||||
help='Distribution version',
|
||||
)
|
||||
|
|
|
@ -45,6 +45,7 @@ def test_get_dlrn_hash_ok(mock_get, mock_logging):
|
|||
mock_log_warning.assert_not_called()
|
||||
mock_log_exception.assert_not_called()
|
||||
|
||||
# centos8 test scenario
|
||||
mock_get.reset_mock()
|
||||
mock_log_info.reset_mock()
|
||||
mock_response.text = '7e8e0fc03b54164921f49fdb4103202c'
|
||||
|
@ -69,6 +70,31 @@ def test_get_dlrn_hash_ok(mock_get, mock_logging):
|
|||
mock_log_warning.assert_not_called()
|
||||
mock_log_exception.assert_not_called()
|
||||
|
||||
# centos9 test scenario
|
||||
mock_get.reset_mock()
|
||||
mock_log_info.reset_mock()
|
||||
mock_response.text = '1b28380bbbe279159578da5c60e567492cbb599d'
|
||||
mock_get.return_value = mock_response
|
||||
release = 'master'
|
||||
hash_name = 'current-tripleo'
|
||||
dlrn_hash = '1b28380bbbe279159578da5c60e567492cbb599d'
|
||||
repo_url = 'https://trunk.rdoproject.org/centos9-%s/%s/delorean.repo.md5' % (
|
||||
release,
|
||||
hash_name,
|
||||
)
|
||||
assert (
|
||||
get_dlrn_hash(release, hash_name, distro_name='centos', distro_version='9')
|
||||
== dlrn_hash
|
||||
)
|
||||
mock_get.assert_called_once_with(repo_url, timeout=8)
|
||||
mock_log_info.assert_called_once_with(
|
||||
"Got DLRN hash: {} for the named "
|
||||
"hash: {} on the {} "
|
||||
"release".format(dlrn_hash, hash_name, release)
|
||||
)
|
||||
mock_log_warning.assert_not_called()
|
||||
mock_log_exception.assert_not_called()
|
||||
|
||||
|
||||
@mock.patch('logging.getLogger')
|
||||
@mock.patch('requests.get')
|
||||
|
|
Loading…
Reference in New Issue