add a warning for repo used in release but not in repository-settings

Change-Id: I5f2acb23977ed3523bc7d098823a7cc5c45e4175
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-02-02 15:44:57 -05:00
parent 22a4fbda53
commit b898e9ace9
2 changed files with 104 additions and 4 deletions

View File

@ -725,9 +725,27 @@ def validate_new_releases(deliverable_info, deliverable_name,
)
for missing in expected_repos.difference(actual_repos):
mk_warning(
'release %s is missing %s from the governance list' %
(final_release['version'], missing)
'release %s is missing %s, '
'which appears in the governance list: %s' %
(final_release['version'], missing, expected_repos)
)
repository_settings = deliverable_info.get('repository-settings', {})
for repo in actual_repos:
if repo not in repository_settings:
# TODO(dhellmann): Turn this into a warning after the T
# series is open.
mk_warning(
'release %s includes repository %s '
'that is not in the repository-settings section' %
(final_release['version'], repo)
)
for missing in repository_settings.keys():
if missing not in actual_repos:
mk_warning(
'release %s is missing %s, '
'which appears in the repository-settings list' %
(final_release['version'], missing)
)
def validate_branch_prefixes(deliverable_info, mk_waring, mk_error):

View File

@ -177,6 +177,7 @@ class TestValidateTeam(base.BaseTestCase):
warnings.append,
errors.append,
)
print(warnings, errors)
self.assertEqual(1, len(warnings))
self.assertEqual(0, len(errors))
@ -1200,8 +1201,13 @@ class TestValidateNewReleases(base.BaseTestCase):
team_data = yamlutils.loads(team_data_yaml)
def test_all_repos(self):
# The repos in the tag, governance, and repository-settings
# match.
deliverable_info = {
'artifact-link-mode': 'none',
'repository-settings': {
'openstack/release-test': {},
},
'releases': [
{'version': '1000.0.0',
'projects': [
@ -1223,9 +1229,14 @@ class TestValidateNewReleases(base.BaseTestCase):
self.assertEqual(0, len(warnings))
self.assertEqual(0, len(errors))
def test_extra_repo(self):
def test_extra_repo_gov(self):
# The tag includes a repo not in governance.
deliverable_info = {
'artifact-link-mode': 'none',
'repository-settings': {
'openstack/release-test': {},
'openstack-infra/release-tools': {},
},
'releases': [
{'version': '1000.0.0',
'projects': [
@ -1250,12 +1261,83 @@ class TestValidateNewReleases(base.BaseTestCase):
self.assertEqual(1, len(warnings))
self.assertEqual(0, len(errors))
def test_missing_repo(self):
def test_missing_repo_gov(self):
# The tag is missing a repo in governance.
deliverable_info = {
'artifact-link-mode': 'none',
'repository-settings': {
'openstack/release-test': {},
'openstack/made-up-name': {},
},
'releases': [
{'version': '1000.0.0',
'projects': [
{'repo': 'openstack/release-test',
'hash': '685da43147c3bedc24906d5a26839550f2e962b1',
'tarball-base': 'openstack-release-test'},
{'repo': 'openstack/made-up-name',
'hash': '685da43147c3bedc24906d5a26839550f2e962b1',
'tarball-base': 'openstack-release-test'},
]}
],
}
warnings = []
errors = []
validate.validate_new_releases(
deliverable_info,
'release-test',
self.team_data,
warnings.append,
errors.append,
)
print(warnings, errors)
self.assertEqual(1, len(warnings))
self.assertEqual(0, len(errors))
def test_extra_repo_info(self):
# The tag has a repo not in repository-settings or governance
# (2 warnings).
deliverable_info = {
'artifact-link-mode': 'none',
'repository-settings': {
},
'releases': [
{'version': '1000.0.0',
'projects': [
{'repo': 'openstack/release-test',
'hash': '685da43147c3bedc24906d5a26839550f2e962b1',
'tarball-base': 'openstack-release-test'},
]}
],
}
warnings = []
errors = []
validate.validate_new_releases(
deliverable_info,
'release-test',
self.team_data,
warnings.append,
errors.append,
)
print(warnings, errors)
self.assertEqual(1, len(warnings))
self.assertEqual(0, len(errors))
def test_missing_repo_info(self):
# The tag is missing a repository that is in
# repository-settings.
deliverable_info = {
'artifact-link-mode': 'none',
'repository-settings': {
'openstack/release-test': {},
'openstack-infra/release-tools': {},
},
'releases': [
{'version': '1000.0.0',
'projects': [
{'repo': 'openstack/release-test',
'hash': '685da43147c3bedc24906d5a26839550f2e962b1',
'tarball-base': 'openstack-release-test'},
]}
],
}