Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions airflow-ctl-tests/tests/airflowctl_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,13 @@ def test_commands(login_command, date_param):
# DAGs commands
"dags list",
"dags get --dag-id=example_bash_operator",
# Order of trigger and pause/unpause is important for test stability because state checked
f"dags trigger --dag-id=example_bash_operator --logical-date={date_param} --run-after={date_param}",
"dags pause --dag-id=example_bash_operator",
"dags unpause --dag-id=example_bash_operator",
"dags update --dag-id=example_bash_operator --is-paused=false",
# DAG Run commands
f"dagrun trigger --dag-id=example_bash_operator --logical-date={date_param} --run-after={date_param}",
f'dagrun get --dag-id=example_bash_operator --dag-run-id="manual__{date_param}"',
"dagrun list --dag-id example_bash_operator --state success --limit=1",
f"dagrun get --dag-id=example_bash_operator --dagrun-id=manual__{date_param}",
f"dagrun delete --dag-id=example_bash_operator --dagrun-id=manual__{date_param}",
# Jobs commands
"jobs list",
# Pools commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ def test_airflowctl_commands(login_command, login_output, test_commands):

# This is a common error message that is thrown by client when something is wrong
# Please ensure it is aligning with airflowctl.api.client.get_json_error
airflowctl_client_server_response_error = "Server error"
airflowctl_command_error = "command error: argument GROUP_OR_COMMAND: invalid choice"
if (
airflowctl_client_server_response_error in stdout_result
or airflowctl_command_error in stdout_result
):
error_strings = [
"Server error",
"command error",
"unrecognized arguments",
"invalid choice",
]
if any(error in stdout_result for error in error_strings):
console.print(f"[red]❌ Output contained unexpected text for command '{command_from_config}'")
console.print(f"[red]Did not expect to find:\n{airflowctl_client_server_response_error}\n")
console.print("[red]Did not expect to find this error.\n")
console.print(f"[red]But got:\n{stdout_result}\n")
raise AssertionError(f"Output contained unexpected text\nOutput:\n{stdout_result}")
console.print(f"[green]✅ Output did not contain unexpected text for command '{command_from_config}'")
Expand Down
Loading