def test_run_with_watchdog_no_reporting(self, m_sleep, m_symlink_log, m_try_push): config = { "name": "the_name", "job_id": "1", "worker_log": "worker_log", "archive_path": "archive/path", "teuthology_branch": "master" } process = Mock() process.poll.return_value = "not None" worker.run_with_watchdog(process, config) m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"]) m_try_push.assert_called_with( dict(name=config["name"], job_id=config["job_id"]), dict(status='dead'))
def test_run_with_watchdog_with_reporting(self, m_sleep, m_symlink_log, m_popen): config = { "name": "the_name", "job_id": "1", "worker_log": "worker_log", "archive_path": "archive/path", "teuthology_branch": "jewel" } process = Mock() process.poll.return_value = "not None" m_proc = Mock() m_proc.poll.return_value = "not None" m_popen.return_value = m_proc worker.run_with_watchdog(process, config) m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"])
def test_run_with_watchdog_with_reporting(self, m_sleep, m_symlink_log, m_popen): config = { "name": "the_name", "job_id": "1", "worker_log": "worker_log", "archive_path": "archive/path", "teuthology_branch": "argonaut" } process = Mock() process.poll.return_value = "not None" m_proc = Mock() m_proc.poll.return_value = "not None" m_popen.return_value = m_proc worker.run_with_watchdog(process, config) m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"]) expected_cmd = "teuthology-report -v -D -r the_name -j 1" m_popen.assert_called_with(expected_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)