Skip to content

Commit

Permalink
test_run: Add test_main_interactive
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Cerza <[email protected]>
  • Loading branch information
zmc committed Oct 2, 2024
1 parent c951c67 commit 74cd0e6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions teuthology/test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,48 @@ def test_main(self, m_report_outcome, m_run_tasks, m_fetch_tasks_if_needed, m_ge
assert fake_ctx["config"]["os_type"] == "os_type"
assert fake_ctx["config"]["os_version"] == "os_version"

@patch("teuthology.run.set_up_logging")
@patch("teuthology.run.setup_config")
@patch("teuthology.run.get_user")
@patch("teuthology.run.write_initial_metadata")
@patch("teuthology.report.try_push_job_info")
@patch("teuthology.run.get_machine_type")
@patch("teuthology.run.get_summary")
@patch("yaml.safe_dump")
@patch("teuthology.run.validate_tasks")
@patch("teuthology.run.get_initial_tasks")
@patch("teuthology.run.fetch_tasks_if_needed")
@patch("teuthology.run.run_tasks")
@patch("teuthology.run.report_outcome")
def test_main_interactive(
self,
m_report_outcome,
m_run_tasks,
m_fetch_tasks_if_needed,
m_get_initial_tasks,
m_validate_tasks,
m_safe_dump,
m_get_summary,
m_get_machine_type,
m_try_push_job_info,
m_write_initial_metadata,
m_get_user,
m_setup_config,
m_set_up_logging,
):
config = {"job_id": 1}
m_setup_config.return_value = config
m_get_machine_type.return_value = "machine_type"
doc = scripts_run.__doc__
args = docopt.docopt(doc, [
"--interactive-on-error",
"path/to/config.yml",
])
run.main(args)
args, kwargs = m_run_tasks.call_args
fake_ctx = kwargs["ctx"]._conf
assert fake_ctx['interactive_on_error'] is True

def test_get_teuthology_command(self):
doc = scripts_run.__doc__
args = docopt.docopt(doc, [
Expand Down

0 comments on commit 74cd0e6

Please sign in to comment.