amoghrajesh commented on code in PR #57955:
URL: https://github.com/apache/airflow/pull/57955#discussion_r2501895573


##########
task-sdk-tests/tests/task_sdk_tests/test_dag_run_operations.py:
##########
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Integration tests for DAG Run operations.
+
+These tests validate the Execution API endpoints for DAG Run operations:
+- get_state(): Get DAG run state
+- get_count(): Get count of DAG runs
+"""
+
+from __future__ import annotations
+
+from airflow.sdk.api.datamodels._generated import DagRunStateResponse
+from airflow.sdk.execution_time.comms import DRCount
+from task_sdk_tests import console
+
+
+def test_dag_run_get_state(sdk_client, dag_info):
+    """Test getting DAG run state."""
+    console.print("[yellow]Getting DAG run state...")
+
+    response = sdk_client.dag_runs.get_state(
+        dag_id=dag_info["dag_id"],
+        run_id=dag_info["dag_run_id"],
+    )
+
+    console.print(" DAG Run State Response ".center(72, "="))
+    console.print(f"[bright_blue]Response Type:[/] {type(response).__name__}")
+    console.print(f"[bright_blue]State:[/] {response.state}")
+    console.print("=" * 72)
+
+    assert isinstance(response, DagRunStateResponse)
+    assert response.state is not None
+    assert response.state in ["running", "success"]
+    console.print("[green]✅ DAG run get state test passed!")
+
+
+def test_dag_run_get_count(sdk_client, dag_info):
+    """Test getting count of DAG runs."""
+    console.print("[yellow]Getting DAG run count...")
+
+    response = sdk_client.dag_runs.get_count(
+        dag_id=dag_info["dag_id"],
+        run_ids=[dag_info["dag_run_id"]],
+    )
+
+    console.print(" DAG Run Count Response ".center(72, "="))

Review Comment:
   It was intentional to get a nice display with a space indented out of the 
mainline logging :)



-- 
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]

Reply via email to