Beispiel #1
0
 def test_sha1_nonexistent(
     self,
     m_package_version_for_hash,
     m_git_branch_exists,
     m_requests_head,
 ):
     config.gitbuilder_host = 'example.com'
     m_package_version_for_hash.return_value = 'ceph_hash'
     m_git_branch_exists.return_value = True
     resp = requests.Response()
     resp.reason = 'Not Found'
     resp.status_code = 404
     m_requests_head.return_value = resp
     with pytest.raises(suite.ScheduleFailError):
         suite.create_initial_config(
             'suite',
             'suite_branch',
             'ceph_branch',
             'ceph_hash_dne',
             'teuth_branch',
             None,
             'kernel_flavor',
             'ubuntu',
             'machine_type',
         )
Beispiel #2
0
 def test_branch_nonexistent(
     self,
     m_git_ls_remote,
     m_package_version_for_hash,
     m_git_branch_exists,
 ):
     config.gitbuilder_host = 'example.com'
     m_git_ls_remote.side_effect = [
         # First call will be for the ceph hash
         None,
         # Second call will be for the suite hash
         'suite_hash',
     ]
     m_package_version_for_hash.return_value = 'a_version'
     m_git_branch_exists.return_value = True
     with pytest.raises(suite.ScheduleFailError):
         suite.create_initial_config(
             'suite',
             'suite_branch',
             'ceph_hash',
             None,
             'teuth_branch',
             None,
             'kernel_flavor',
             'ubuntu',
             'machine_type',
         )
Beispiel #3
0
 def test_config_bogus_teuthology_branch(self):
     # Don't attempt to send email
     config.results_email = None
     with raises(suite.ScheduleFailError):
         suite.create_initial_config('s', None, 'master',
                                     'bogus_teuth_branch', 'k', 'f', 'd',
                                     'm')
Beispiel #4
0
 def test_config_bogus_teuthology_branch(self):
     # Don't attempt to send email
     config.results_email = None
     with raises(suite.ScheduleFailError):
         suite.create_initial_config('s', None, 'master',
                                     'bogus_teuth_branch', 'k', 'f', 'd',
                                     'm')
Beispiel #5
0
 def test_sha1_exists(
     self,
     m_git_ls_remote,
     m_package_version_for_hash,
     m_git_branch_exists,
     m_requests_head,
 ):
     config.gitbuilder_host = 'example.com'
     m_package_version_for_hash.return_value = 'ceph_hash'
     m_git_branch_exists.return_value = True
     resp = requests.Response()
     resp.reason = 'OK'
     resp.status_code = 200
     m_requests_head.return_value = resp
     # only one call to git_ls_remote in this case
     m_git_ls_remote.return_value = "suite_branch"
     result = suite.create_initial_config(
         'suite',
         'suite_branch',
         'ceph_branch',
         'ceph_hash',
         'teuth_branch',
         None,
         'kernel_flavor',
         'ubuntu',
         'machine_type',
     )
     assert result.sha1 == 'ceph_hash'
     assert result.branch == 'ceph_branch'
Beispiel #6
0
 def test_config_kernel_section(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('MY_SUITE', 'master',
                                              'master', 'master', 'testing',
                                              'basic', 'centos', 'plana')
     assert job_config['kernel']['kdb'] is True
Beispiel #7
0
 def test_config_substitution(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('MY_SUITE', 'master',
                                              'master', 'master', 'testing',
                                              'basic', 'centos', 'plana')
     assert job_config['suite'] == 'MY_SUITE'
Beispiel #8
0
 def test_config_kernel_section(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('MY_SUITE', 'master',
                                              'master', 'master', 'testing',
                                              'default', 'centos', 'plana')
     assert job_config['kernel']['kdb'] is True
Beispiel #9
0
 def test_config_substitution(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('MY_SUITE', 'master',
                                              'master', 'master', 'testing',
                                              'default', 'centos', 'plana')
     assert job_config['suite'] == 'MY_SUITE'
Beispiel #10
0
 def test_all_master_branches(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('suite', 'master',
                                              'master', 'master', 'testing',
                                              'basic', 'centos', 'plana')
     assert ((job_config.branch, job_config.teuthology_branch,
              job_config.suite_branch) == ('master', 'master', 'master'))
Beispiel #11
0
 def test_all_master_branches(self):
     # Don't attempt to send email
     config.results_email = None
     job_config = suite.create_initial_config('suite', 'master', 'master',
                                              'master', 'testing',
                                              'default', 'centos', 'plana')
     assert ((job_config.branch, job_config.teuthology_branch,
              job_config.suite_branch) == ('master', 'master', 'master'))
Beispiel #12
0
 def test_sha1_nonexistent(
     self,
     m_package_version_for_hash,
     m_git_branch_exists,
     m_requests_head,
 ):
     config.gitbuilder_host = 'example.com'
     m_package_version_for_hash.return_value = 'ceph_hash'
     m_git_branch_exists.return_value = True
     resp = requests.Response()
     resp.reason = 'Not Found'
     resp.status_code = 404
     m_requests_head.return_value = resp
     with pytest.raises(suite.ScheduleFailError):
         suite.create_initial_config(
             'suite', 'suite_branch', 'ceph_branch', 'ceph_hash_dne',
             'teuth_branch', None, 'kernel_flavor', 'ubuntu',
             'machine_type',
         )
Beispiel #13
0
 def test_branch_nonexistent(
     self,
     m_git_ls_remote,
     m_package_version_for_hash,
     m_git_branch_exists,
 ):
     config.gitbuilder_host = 'example.com'
     m_git_ls_remote.side_effect = [
         # First call will be for the ceph hash
         None,
         # Second call will be for the suite hash
         'suite_hash',
     ]
     m_package_version_for_hash.return_value = 'a_version'
     m_git_branch_exists.return_value = True
     with pytest.raises(suite.ScheduleFailError):
         suite.create_initial_config(
             'suite', 'suite_branch', 'ceph_hash', None,
             'teuth_branch', None, 'kernel_flavor', 'ubuntu',
             'machine_type',
         )
Beispiel #14
0
 def test_sha1_exists(
     self,
     m_git_ls_remote,
     m_package_version_for_hash,
     m_git_branch_exists,
     m_requests_head,
 ):
     config.gitbuilder_host = 'example.com'
     m_package_version_for_hash.return_value = 'ceph_hash'
     m_git_branch_exists.return_value = True
     resp = requests.Response()
     resp.reason = 'OK'
     resp.status_code = 200
     m_requests_head.return_value = resp
     # only one call to git_ls_remote in this case
     m_git_ls_remote.return_value = "suite_branch"
     result = suite.create_initial_config(
         'suite', 'suite_branch', 'ceph_branch', 'ceph_hash',
         'teuth_branch', None, 'kernel_flavor', 'ubuntu', 'machine_type',
     )
     assert result.sha1 == 'ceph_hash'
     assert result.branch == 'ceph_branch'
Beispiel #15
0
 def test_config_bogus_kernel_flavor(self):
     # Don't attempt to send email
     config.results_email = None
     with raises(suite.ScheduleFailError):
         suite.create_initial_config('s', 'c', 't', 'k',
                                     'bogus_kernel_flavor', 'd', 'm')
Beispiel #16
0
 def test_config_bogus_flavor(self):
     # Don't attempt to send email
     config.results_email = None
     with raises(suite.ScheduleFailError):
         suite.create_initial_config('s', None, 'master', 't', 'k',
                                     'bogus_flavor', 'd', 'm')