pierrejeambrun commented on code in PR #47440:
URL: https://github.com/apache/airflow/pull/47440#discussion_r1999385213
##########
tests/api_fastapi/core_api/routes/public/test_dags.py:
##########
@@ -228,6 +228,17 @@ class TestGetDags(TestDagEndpoint):
3,
[DAG3_ID, DAG1_ID, DAG2_ID],
),
+ ({"order_by": ["-dag_id", "dag_display_name"]}, 2, [DAG2_ID,
DAG1_ID]),
+ ({"order_by": ["dag_display_name", "-next_dagrun"]}, 2, [DAG1_ID,
DAG2_ID]),
+ ({"order_by": ["last_run_state", "-dag_display_name", "dag_id"]},
2, [DAG1_ID, DAG2_ID]),
+ ({"order_by": ["-last_run_start_date", "dag_display_name",
"next_dagrun", "dag_id"]}, 2, [ DAG1_ID, DAG2_ID]),
+ ({"order_by": ["dag_display_name", "-last_run_state",
"next_dagrun", "dag_id", "last_run_start_date"]}, 2, [DAG1_ID, DAG2_ID]),
+ ({"order_by": ["dag_display_name", "dag_id"]}, 2, [DAG1_ID,
DAG2_ID]),
+ ({"order_by": ["-dag_display_name", "-dag_id"]}, 2, [DAG2_ID,
DAG1_ID]),
+ ({"order_by": ["last_run_state", "dag_id"], "only_active":
False},3, [DAG1_ID, DAG3_ID, DAG2_ID]),
+ ({"order_by": ["-last_run_state", "-dag_id"], "only_active":
False},3, [DAG3_ID, DAG1_ID, DAG2_ID]),
+ ({"order_by": ["-last_run_start_date", "dag_id"], "only_active":
False},3, [DAG3_ID, DAG1_ID, DAG2_ID]),
+ ({"order_by": ["last_run_start_date", "-dag_id"], "only_active":
False},3, [DAG1_ID, DAG3_ID, DAG2_ID]),
Review Comment:
Can you reorganize this and put tests that sort on the same criteria next to
each other. For instance `criteria1` is 'last_run_state', then `criteria2` is
"display_name" so we can more easily compare.
Also for the second sort to take effect you need data where the first
criteria is equal. I'm not sure we have this at the moment.
Basically we need to tests where:
`{"order_by": ["criteria1", "criteria2"]}` will yield a different result
than `{"order_by": ["criteria1", "-criteria2"]}` to highlight that `criteria2`
sorting is actually doing something and taken into account.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]