Merge "Add tripleo-ci-testing to tripleo-repos for use in periodics"
This commit is contained in:
commit
7dfdcbdca1
|
@ -90,7 +90,8 @@ def _parse_args():
|
|||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('repos', metavar='REPO', nargs='+',
|
||||
choices=['current', 'deps', 'current-tripleo',
|
||||
'current-tripleo-dev', 'ceph', 'opstools'],
|
||||
'current-tripleo-dev', 'ceph', 'opstools',
|
||||
'tripleo-ci-testing'],
|
||||
help='A list of repos. Available repos: '
|
||||
'%(choices)s. The deps repo will always be '
|
||||
'included when using current or '
|
||||
|
@ -162,10 +163,11 @@ def _validate_distro_repos(args):
|
|||
"""Validate requested repos are valid for the distro"""
|
||||
valid_repos = []
|
||||
if 'fedora' in args.distro:
|
||||
valid_repos = ['current', 'current-tripleo', 'ceph', 'deps']
|
||||
valid_repos = ['current', 'current-tripleo', 'ceph', 'deps',
|
||||
'tripleo-ci-testing']
|
||||
elif args.distro in ['centos7']:
|
||||
valid_repos = ['ceph', 'current', 'current-tripleo',
|
||||
'current-tripleo-dev', 'deps']
|
||||
'current-tripleo-dev', 'deps', 'tripleo-ci-testing']
|
||||
invalid_repos = [x for x in args.repos if x not in valid_repos]
|
||||
if len(invalid_repos) > 0:
|
||||
raise InvalidArguments('{} repo(s) are not valid for {}. Valid repos '
|
||||
|
@ -192,9 +194,25 @@ def _validate_current_tripleo(repos):
|
|||
return True
|
||||
|
||||
|
||||
def _validate_tripleo_ci_testing(repos):
|
||||
"""Validate tripleo-ci-testing
|
||||
|
||||
With tripleo-ci-testing for repo (currently only periodic container build)
|
||||
no other repos expected except optionally deps which is enabled regardless.
|
||||
"""
|
||||
if 'tripleo-ci-testing' in repos and len(repos) > 1:
|
||||
if 'deps' in repos and len(repos) == 2:
|
||||
return True
|
||||
else:
|
||||
raise InvalidArguments('Cannot use tripleo-ci-testing at the '
|
||||
'same time as other repos, except deps.')
|
||||
return True
|
||||
|
||||
|
||||
def _validate_args(args):
|
||||
_validate_current_tripleo(args.repos)
|
||||
_validate_distro_repos(args)
|
||||
_validate_tripleo_ci_testing(args.repos)
|
||||
|
||||
|
||||
def _remove_existing(args):
|
||||
|
@ -290,6 +308,11 @@ def _install_repos(args, base_path):
|
|||
content += '\n%s' % INCLUDE_PKGS
|
||||
content = _change_priority(content, 10)
|
||||
_write_repo(content, args.output_path)
|
||||
elif repo == 'tripleo-ci-testing':
|
||||
content = _get_repo(base_path + 'tripleo-ci-testing/delorean.repo',
|
||||
args)
|
||||
_write_repo(content, args.output_path)
|
||||
install_deps(args, base_path)
|
||||
elif repo == 'ceph':
|
||||
if args.branch in ['liberty', 'mitaka']:
|
||||
content = _create_ceph(args, 'hammer')
|
||||
|
|
|
@ -238,6 +238,25 @@ class TestTripleORepos(testtools.TestCase):
|
|||
'priority=10' %
|
||||
main.INCLUDE_PKGS, 'test')
|
||||
|
||||
@mock.patch('tripleo_repos.main._get_repo')
|
||||
@mock.patch('tripleo_repos.main._write_repo')
|
||||
def test_install_repos_tripleo_ci_testing(self, mock_write, mock_get):
|
||||
args = mock.Mock()
|
||||
args.repos = ['tripleo-ci-testing']
|
||||
args.branch = 'master'
|
||||
args.output_path = 'test'
|
||||
mock_get.return_value = '[delorean]\nMr. Fusion'
|
||||
main._install_repos(args, 'roads/')
|
||||
self.assertEqual([mock.call('roads/tripleo-ci-testing/delorean.repo',
|
||||
args),
|
||||
mock.call('roads/delorean-deps.repo', args),
|
||||
],
|
||||
mock_get.mock_calls)
|
||||
self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test'),
|
||||
mock.call('[delorean]\nMr. Fusion', 'test'),
|
||||
],
|
||||
mock_write.mock_calls)
|
||||
|
||||
@mock.patch('tripleo_repos.main._write_repo')
|
||||
@mock.patch('tripleo_repos.main._create_ceph')
|
||||
def test_install_repos_ceph(self, mock_create_ceph, mock_write_repo):
|
||||
|
@ -456,6 +475,15 @@ class TestValidate(testtools.TestCase):
|
|||
self.assertRaises(main.InvalidArguments, main._validate_args,
|
||||
self.args)
|
||||
|
||||
def test_tripleo_ci_testing_and_current_tripleo(self):
|
||||
self.args.repos = ['current-tripleo', 'tripleo-ci-testing']
|
||||
self.assertRaises(main.InvalidArguments, main._validate_args,
|
||||
self.args)
|
||||
|
||||
def test_tripleo_ci_testing_and_deps_allowed(self):
|
||||
self.args.repos = ['deps', 'tripleo-ci-testing']
|
||||
main._validate_args(self.args)
|
||||
|
||||
def test_ceph_and_tripleo_dev(self):
|
||||
self.args.repos = ['current-tripleo-dev', 'ceph']
|
||||
self.args.output_path = main.DEFAULT_OUTPUT_PATH
|
||||
|
|
Loading…
Reference in New Issue