Skip to content

Commit

Permalink
Add missing test for cli triggerer command (#37743)
Browse files Browse the repository at this point in the history
* increase code coverage for cli triggerer_command

* unused import
  • Loading branch information
okirialbert committed Feb 27, 2024
1 parent 8f4c1a6 commit 413e364
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 0 additions & 1 deletion scripts/cov/cli_coverage.py
Expand Up @@ -46,7 +46,6 @@
"airflow/cli/commands/scheduler_command.py",
"airflow/cli/commands/standalone_command.py",
"airflow/cli/commands/task_command.py",
"airflow/cli/commands/triggerer_command.py",
"airflow/cli/commands/variable_command.py",
"airflow/cli/commands/webserver_command.py",
"airflow/cli/simple_table.py",
Expand Down
13 changes: 13 additions & 0 deletions tests/cli/commands/test_triggerer_command.py
Expand Up @@ -50,3 +50,16 @@ def test_capacity_argument(
mock_serve.return_value.__enter__.assert_called_once()
mock_serve.return_value.__exit__.assert_called_once()
mock_triggerer_job_runner.assert_called_once_with(job=mock.ANY, capacity=42)

@mock.patch("airflow.cli.commands.triggerer_command.TriggererJobRunner")
@mock.patch("airflow.cli.commands.triggerer_command.run_job")
@mock.patch("airflow.cli.commands.triggerer_command.Process")
def test_trigger_run_serve_logs(self, mock_process, mock_run_job, mock_trigger_job_runner):
"""Ensure that trigger runner and server log functions execute as intended"""
triggerer_command.triggerer_run(False, 1, 10.3)

mock_process.assert_called_once()
mock_run_job.assert_called_once_with(
job=mock_trigger_job_runner.return_value.job,
execute_callable=mock_trigger_job_runner.return_value._execute,
)

0 comments on commit 413e364

Please sign in to comment.