These tests were hitting the network.
Signed-off-by: Zack Cerza <zack@redhat.com>
assert run.base_config.sha1 == 'ceph_sha1'
assert run.base_config.branch == 'ceph_branch'
+ @patch('teuthology.suite.run.util.git_ls_remote')
@patch('requests.head')
@patch('teuthology.suite.util.git_branch_exists')
@patch('teuthology.suite.util.package_version_for_hash')
def test_sha1_nonexistent(
self,
+ m_git_ls_remote,
m_package_version_for_hash,
m_git_branch_exists,
m_requests_head,
from teuthology.config import config
from teuthology.orchestra.opsys import OS
from teuthology.suite import util
-from teuthology.exceptions import ScheduleFailError
+from teuthology.exceptions import BranchNotFoundError, ScheduleFailError
REPO_PROJECTS_AND_URLS = [
assert str(exc.value) == "Scheduling failed: error msg"
m_smtp.assert_not_called()
+ @patch('teuthology.suite.util.fetch_qa_suite')
@patch('teuthology.suite.util.smtplib.SMTP')
- def test_fetch_repo_no_branch(self, m_smtp):
+ def test_fetch_repo_no_branch(self, m_smtp, m_fetch_qa_suite):
+ m_fetch_qa_suite.side_effect = BranchNotFoundError(
+ "no-branch", "https://github.com/ceph/ceph-ci.git")
config.results_email = "example@example.com"
with pytest.raises(ScheduleFailError) as exc:
util.fetch_repos("no-branch", "test1", dry_run=False)
Branch 'no-branch' not found in repo: https://github.com/ceph/ceph-ci.git!"
m_smtp.assert_called()
+ @patch('teuthology.suite.util.fetch_qa_suite')
@patch('teuthology.suite.util.smtplib.SMTP')
- def test_fetch_repo_no_branch_dryrun(self, m_smtp):
+ def test_fetch_repo_no_branch_dryrun(self, m_smtp, m_fetch_qa_suite):
+ m_fetch_qa_suite.side_effect = BranchNotFoundError(
+ "no-branch", "https://github.com/ceph/ceph-ci.git")
config.results_email = "example@example.com"
with pytest.raises(ScheduleFailError) as exc:
util.fetch_repos("no-branch", "test1", dry_run=True)
worker.run_with_watchdog(process, config)
m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"])
+ @patch("teuthology.worker.ls_remote")
@patch("os.path.isdir")
@patch("teuthology.worker.fetch_teuthology")
@patch("teuthology.worker.teuth_config")
@patch("teuthology.worker.fetch_qa_suite")
- def test_prep_job(self, m_fetch_qa_suite,
- m_teuth_config,
- m_fetch_teuthology, m_isdir):
+ def test_prep_job(self, m_fetch_qa_suite, m_teuth_config,
+ m_fetch_teuthology, m_isdir, m_ls_remote):
config = dict(
name="the_name",
job_id="1",
job.bury.assert_called_once_with()
job.delete.assert_called_once_with()
+ @patch("teuthology.worker.ls_remote")
@patch("teuthology.worker.report.try_push_job_info")
@patch("teuthology.worker.run_job")
@patch("beanstalkc.Job", autospec=True)
def test_main_loop_13925(
self, m_setup_log_file, m_isdir, m_connect, m_watch_tube,
m_fetch_teuthology, m_fetch_qa_suite, m_job, m_run_job,
- m_try_push_job_info,
+ m_try_push_job_info, m_ls_remote,
):
m_connection = Mock()
jobs = self.build_fake_jobs(