Skip to content

Commit

Permalink
Merge pull request #2007 from ceph/wip-68285
Browse files Browse the repository at this point in the history
run: Fix reference to ctx for interactive jobs
  • Loading branch information
zmc authored Oct 7, 2024
2 parents 3fa33a2 + c74fd88 commit c2de527
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion teuthology/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def main(args):
# FIXME this should become more generic, and the keys should use
# '_' uniformly
if fake_ctx.config.get('interactive-on-error'):
teuth_config.config.ctx = fake_ctx
teuth_config.ctx = fake_ctx

try:
run_tasks(tasks=config['tasks'], ctx=fake_ctx)
Expand Down
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 c2de527

Please sign in to comment.