9dbb30dce1
Change the 'std' release type to 'python-server' and add a 'python-pypi' release type for deliverables that are published to PyPI. Separate the release job validation from the validation of release version numbers and other settings to make the logic clearer. Add a new function to determine the release type for a project, either by checking the explicit value or guessing. Update the unit tests that relied on 'std'. Remove a unit test that tested a code path that has been removed. Change-Id: I704ec75fec61ecb6ee379239a5fa8612cb01b426 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
137 lines
3.8 KiB
Python
137 lines
3.8 KiB
Python
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from oslotest import base
|
|
|
|
from openstack_releases import project_config
|
|
|
|
|
|
class TestReleaseJobsStandard(base.BaseTestCase):
|
|
|
|
def test_no_artifact_flag(self):
|
|
deliverable_info = {
|
|
'repository-settings': {
|
|
'openstack/releases': {
|
|
'flags': [
|
|
'no-artifact-build-job',
|
|
],
|
|
},
|
|
},
|
|
}
|
|
zuul_projects = {
|
|
}
|
|
warnings = []
|
|
errors = []
|
|
project_config.require_release_jobs_for_repo(
|
|
deliverable_info,
|
|
{'validate-projects-by-name': zuul_projects},
|
|
'openstack/releases',
|
|
'std',
|
|
warnings.append,
|
|
errors.append,
|
|
)
|
|
self.assertEqual(0, len(warnings))
|
|
self.assertEqual(0, len(errors))
|
|
|
|
def test_retired_flag(self):
|
|
deliverable_info = {
|
|
'repository-settings': {
|
|
'openstack/releases': {
|
|
'flags': [
|
|
'retired',
|
|
]
|
|
}
|
|
}
|
|
}
|
|
zuul_projects = {
|
|
}
|
|
warnings = []
|
|
errors = []
|
|
project_config.require_release_jobs_for_repo(
|
|
deliverable_info,
|
|
{'validate-projects-by-name': zuul_projects},
|
|
'openstack/releases',
|
|
'std',
|
|
warnings.append,
|
|
errors.append,
|
|
)
|
|
self.assertEqual(0, len(warnings))
|
|
self.assertEqual(0, len(errors))
|
|
|
|
def test_no_zuul_projects(self):
|
|
deliverable_info = {
|
|
}
|
|
zuul_projects = {
|
|
}
|
|
warnings = []
|
|
errors = []
|
|
project_config.require_release_jobs_for_repo(
|
|
deliverable_info,
|
|
{'validate-projects-by-name': zuul_projects},
|
|
'openstack/releases',
|
|
'std',
|
|
warnings.append,
|
|
errors.append,
|
|
)
|
|
self.assertEqual(0, len(warnings))
|
|
self.assertEqual(1, len(errors))
|
|
|
|
def test_one_expected_job(self):
|
|
deliverable_info = {
|
|
}
|
|
zuul_projects = {
|
|
'openstack/releases': {
|
|
'templates': [
|
|
'publish-to-pypi',
|
|
],
|
|
},
|
|
}
|
|
warnings = []
|
|
errors = []
|
|
project_config.require_release_jobs_for_repo(
|
|
deliverable_info,
|
|
zuul_projects,
|
|
'openstack/releases',
|
|
'python-pypi',
|
|
warnings.append,
|
|
errors.append,
|
|
)
|
|
print(warnings, errors)
|
|
self.assertEqual(0, len(warnings))
|
|
self.assertEqual(0, len(errors))
|
|
|
|
def test_two_expected_jobs(self):
|
|
deliverable_info = {
|
|
}
|
|
zuul_projects = {
|
|
'openstack/releases': {
|
|
'templates': [
|
|
'publish-to-pypi',
|
|
'puppet-tarball-jobs',
|
|
],
|
|
}
|
|
}
|
|
warnings = []
|
|
errors = []
|
|
project_config.require_release_jobs_for_repo(
|
|
deliverable_info,
|
|
zuul_projects,
|
|
'openstack/releases',
|
|
'python-pypi',
|
|
warnings.append,
|
|
errors.append,
|
|
)
|
|
self.assertEqual(0, len(warnings))
|
|
self.assertEqual(1, len(errors))
|