예제 #1
0
 def test_install_repos_ceph_mitaka(self, mock_install_ceph):
     args = mock.Mock()
     args.repos = ['ceph']
     args.branch = 'mitaka'
     args.output_path = 'test'
     main._install_repos(args, 'roads/')
     mock_install_ceph.assert_called_with('hammer')
예제 #2
0
    def test_install_repos_deps_mirror(self, mock_write, mock_get):
        args = mock.Mock()
        args.repos = ['deps']
        args.branch = 'master'
        args.output_path = 'test'
        args.old_mirror = 'http://mirror.centos.org'
        args.mirror = 'http://foo'
        args.distro = 'centos'
        args.rdo_mirror = 'http://bar'
        # Abbreviated repos to verify the regex works
        fake_repo = '''
[delorean-current-tripleo]
name=test repo
baseurl=https://trunk.rdoproject.org/centos7/some-repo-hash
enabled=1

[rdo-qemu-ev]
name=test qemu-ev
baseurl=http://mirror.centos.org/centos/7/virt/$basearch/kvm-common
enabled=1
'''
        expected_repo = '''
[delorean-current-tripleo]
name=test repo
baseurl=http://bar/centos7/some-repo-hash
enabled=1

[rdo-qemu-ev]
name=test qemu-ev
baseurl=http://foo/centos/7/virt/$basearch/kvm-common
enabled=1
'''
        mock_get.return_value = mock.Mock(text=fake_repo, status_code=200)
        main._install_repos(args, 'roads/')
        mock_write.assert_called_once_with(expected_repo, 'test')
예제 #3
0
 def test_install_repos_ceph_mitaka(self, mock_install_ceph):
     args = mock.Mock()
     args.repos = ['ceph']
     args.branch = 'mitaka'
     args.output_path = 'test'
     main._install_repos(args, 'roads/')
     mock_install_ceph.assert_called_with('hammer')
예제 #4
0
 def test_install_repos_ceph(self, branch, mock_create_ceph,
                             mock_write_repo):
     ceph_release = {
         'liberty': 'hammer',
         'mitaka': 'hammer',
         'newton': 'jewel',
         'ocata': 'jewel',
         'pike': 'jewel',
         'queens': 'luminous',
         'rocky': 'luminous',
         'stein': 'nautilus',
         'train': 'nautilus',
         'ussuri': 'nautilus',
         'victoria': 'nautilus',
         'master': 'pacific',
     }
     args = mock.Mock()
     args.repos = ['ceph']
     args.branch = branch
     args.output_path = 'test'
     args.distro = 'fake'
     mock_repo = '[centos-ceph-luminous]\nMr. Fusion'
     mock_create_ceph.return_value = mock_repo
     main._install_repos(args, 'roads/')
     mock_create_ceph.assert_called_once_with(args, ceph_release[branch])
     mock_write_repo.assert_called_once_with(mock_repo, 'test')
예제 #5
0
 def test_install_repos_centos8_stream(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current']
     args.branch = 'master'
     args.output_path = 'test'
     args.distro = 'centos8'
     args.stream = True
     args.mirror = 'mirror'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([
         mock.call('roads/current/delorean.repo', args),
         mock.call('roads/delorean-deps.repo', args),
     ], mock_get.mock_calls)
     self.assertEqual([
         mock.call('[delorean]\nMr. Fusion', 'test', name='delorean'),
         mock.call('[delorean]\nMr. Fusion', 'test'),
         mock.call(('\n[tripleo-centos-highavailability]\n'
                    'name=tripleo-centos-highavailability\n'
                    'baseurl=mirror/centos/8-stream/HighAvailability'
                    '/$basearch/os/\ngpgcheck=0\nenabled=1\n'), 'test'),
         mock.call(('\n[tripleo-centos-powertools]\n'
                    'name=tripleo-centos-powertools\n'
                    'baseurl=mirror/centos/8-stream/PowerTools'
                    '/$basearch/os/\ngpgcheck=0\nenabled=1\n'), 'test')
     ], mock_write.mock_calls)
예제 #6
0
 def test_install_repos_opstools(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['opstools']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[centos-opstools]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_called_once_with(main.OPSTOOLS_REPO_URL)
     mock_write.assert_called_once_with('[centos-opstools]\nMr. Fusion',
                                        'test')
예제 #7
0
 def test_install_repos_deps(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['deps']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean-deps]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_called_once_with('roads/delorean-deps.repo')
     mock_write.assert_called_once_with('[delorean-deps]\nMr. Fusion',
                                        'test')
예제 #8
0
 def test_install_repos_deps(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['deps']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean-deps]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_called_once_with('roads/delorean-deps.repo', args)
     mock_write.assert_called_once_with('[delorean-deps]\nMr. Fusion',
                                        'test')
예제 #9
0
 def test_install_repos_opstools(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['opstools']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[centos-opstools]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_called_once_with(main.OPSTOOLS_REPO_URL)
     mock_write.assert_called_once_with('[centos-opstools]\nMr. Fusion',
                                        'test')
예제 #10
0
 def test_install_repos_opstools(self, mock_write):
     args = mock.Mock()
     args.repos = ['opstools']
     args.branch = 'master'
     args.output_path = 'test'
     args.mirror = 'http://foo'
     main._install_repos(args, 'roads/')
     expected_repo = ('\n[tripleo-centos-opstools]\n'
                      'name=tripleo-centos-opstools\n'
                      'baseurl=http://foo/centos/7/opstools/$basearch/\n'
                      'gpgcheck=0\n'
                      'enabled=1\n')
     mock_write.assert_called_once_with(expected_repo, 'test')
예제 #11
0
 def test_install_repos_current_mitaka(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current']
     args.branch = 'mitaka'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([
         mock.call('roads/current/delorean.repo'),
         mock.call('roads/delorean-deps.repo'),
     ], mock_get.mock_calls)
     self.assertEqual([
         mock.call('[delorean-mitaka]\nMr. Fusion', 'test'),
         mock.call('[delorean]\nMr. Fusion', 'test'),
     ], mock_write.mock_calls)
예제 #12
0
 def test_install_repos_current_tripleo_rdo(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current-tripleo-rdo']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([
         mock.call('roads/current-tripleo-rdo/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)
예제 #13
0
 def test_install_repos_current_mitaka(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current']
     args.branch = 'mitaka'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([mock.call('roads/current/delorean.repo'),
                       mock.call('roads/delorean-deps.repo'),
                       ],
                      mock_get.mock_calls)
     self.assertEqual([mock.call('[delorean-mitaka]\nMr. Fusion', 'test'),
                       mock.call('[delorean]\nMr. Fusion', 'test'),
                       ],
                      mock_write.mock_calls)
예제 #14
0
 def test_install_repos_current(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current']
     args.branch = 'master'
     args.output_path = 'test'
     args.distro = 'fake'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([
         mock.call('roads/current/delorean.repo', args),
         mock.call('roads/delorean-deps.repo', args),
     ], mock_get.mock_calls)
     self.assertEqual([
         mock.call('[delorean]\nMr. Fusion', 'test', name='delorean'),
         mock.call('[delorean]\nMr. Fusion', 'test'),
     ], mock_write.mock_calls)
예제 #15
0
 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'
     args.distro = 'fake'
     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)
예제 #16
0
 def test_install_repos_current_tripleo(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current-tripleo']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([mock.call('http://buildlogs.centos.org/centos/'
                                 '7/cloud/x86_64/rdo-trunk-master-'
                                 'tripleo/delorean.repo'),
                       mock.call('roads/delorean-deps.repo'),
                       ],
                      mock_get.mock_calls)
     self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test'),
                       mock.call('[delorean]\nMr. Fusion', 'test'),
                       ],
                      mock_write.mock_calls)
예제 #17
0
 def test_install_repos_current_tripleo(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current-tripleo']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     self.assertEqual([
         mock.call('http://buildlogs.centos.org/centos/'
                   '7/cloud/x86_64/rdo-trunk-master-'
                   'tripleo/delorean.repo'),
         mock.call('roads/delorean-deps.repo'),
     ], mock_get.mock_calls)
     self.assertEqual([
         mock.call('[delorean]\nMr. Fusion', 'test'),
         mock.call('[delorean]\nMr. Fusion', 'test'),
     ], mock_write.mock_calls)
예제 #18
0
 def test_install_repos_current_tripleo_dev(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current-tripleo-dev']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_any_call('roads/delorean-deps.repo', args)
     # This is the wrong name for the deps repo, but I'm not bothered
     # enough by that to mess with mocking multiple different calls.
     mock_write.assert_any_call('[delorean]\n'
                                'Mr. Fusion', 'test')
     mock_get.assert_any_call('roads/current-tripleo/delorean.repo', args)
     mock_write.assert_any_call('[delorean-current-tripleo]\n'
                                'Mr. Fusion\npriority=20', 'test')
     mock_get.assert_called_with('roads/current/delorean.repo', args)
     mock_write.assert_called_with('[delorean]\nMr. Fusion\n%s\n'
                                   'priority=10' %
                                   main.INCLUDE_PKGS, 'test')
예제 #19
0
 def test_install_repos_current_tripleo_dev(self, mock_write, mock_get):
     args = mock.Mock()
     args.repos = ['current-tripleo-dev']
     args.branch = 'master'
     args.output_path = 'test'
     mock_get.return_value = '[delorean]\nMr. Fusion'
     main._install_repos(args, 'roads/')
     mock_get.assert_any_call('roads/delorean-deps.repo')
     # This is the wrong name for the deps repo, but I'm not bothered
     # enough by that to mess with mocking multiple different calls.
     mock_write.assert_any_call('[delorean]\n'
                                'Mr. Fusion', 'test')
     mock_get.assert_any_call('http://buildlogs.centos.org/centos/'
                              '7/cloud/x86_64/rdo-trunk-master-'
                              'tripleo/delorean.repo')
     mock_write.assert_any_call('[delorean-current-tripleo]\n'
                                'Mr. Fusion\npriority=20', 'test')
     mock_get.assert_called_with('roads/current/delorean.repo')
     mock_write.assert_called_with('[delorean]\nMr. Fusion\n%s\n'
                                   'priority=10' %
                                   main.INCLUDE_PKGS, 'test')