jason810496 commented on code in PR #53332:
URL: https://github.com/apache/airflow/pull/53332#discussion_r2219748697


##########
task-sdk-tests/tests/task_sdk_tests/test_task_sdk_health.py:
##########
@@ -0,0 +1,119 @@
+# 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.
+from __future__ import annotations
+
+import os
+import subprocess
+from pathlib import Path
+from shutil import copyfile
+
+from python_on_whales import DockerClient, docker
+from rich.console import Console
+
+from task_sdk_tests.constants import AIRFLOW_ROOT_PATH, TASK_SDK_API_VERSION, 
TASK_SDK_HOST_PORT
+
+console = Console(width=400, color_system="standard")
+
+TASK_SDK_TESTS_ROOT = Path(__file__).parent.parent.parent
+
+
+def print_diagnostics(compose, compose_version, docker_version):
+    """Print diagnostic information when test fails."""
+    console.print("[red]=== DIAGNOSTIC INFORMATION ===[/]")
+    console.print(f"Docker version: {docker_version}")
+    console.print(f"Docker Compose version: {compose_version}")
+    console.print("\n[yellow]Container Status:[/]")
+    try:
+        containers = compose.compose.ps()
+        for container in containers:
+            console.print(f"  {container.name}: {container.state}")
+    except Exception as e:
+        console.print(f"  Error getting container status: {e}")
+
+    console.print("\n[yellow]Container Logs:[/]")
+    try:
+        logs = compose.compose.logs()
+        console.print(logs)
+    except Exception as e:
+        console.print(f"  Error getting logs: {e}")
+
+
+def test_task_sdk_health(tmp_path_factory, monkeypatch):
+    """Test Task SDK health check using docker-compose environment."""
+    tmp_dir = tmp_path_factory.mktemp("airflow-task-sdk-test")
+    console.print(f"[yellow]Tests are run in {tmp_dir}")
+
+    # Copy docker-compose.yaml to temp directory
+    docker_compose_file = TASK_SDK_TESTS_ROOT / "docker" / 
"docker-compose.yaml"

Review Comment:
   Would making the `docker_compose_file` constant more consistent with other 
usage?



##########
task-sdk-tests/tests/task_sdk_tests/conftest.py:
##########
@@ -0,0 +1,26 @@
+# 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.
+from __future__ import annotations
+
+import pytest
+
+from task_sdk_tests.constants import DOCKER_IMAGE
+
+
[email protected]
+def default_docker_image():

Review Comment:
   It seems the `default_docker_image` fixture will never be used and the 
further test can just import from the `task_sdk_tests.constants`.



##########
task-sdk-tests/tests/task_sdk_tests/test_task_sdk_health.py:
##########
@@ -0,0 +1,119 @@
+# 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.
+from __future__ import annotations
+
+import os
+import subprocess
+from pathlib import Path
+from shutil import copyfile
+
+from python_on_whales import DockerClient, docker
+from rich.console import Console
+
+from task_sdk_tests.constants import AIRFLOW_ROOT_PATH, TASK_SDK_API_VERSION, 
TASK_SDK_HOST_PORT
+
+console = Console(width=400, color_system="standard")
+
+TASK_SDK_TESTS_ROOT = Path(__file__).parent.parent.parent

Review Comment:
   Would placing the `TASK_SDK_TESTS_ROOT` variable in 
`task_sdk_tests.constants` more suitable ?



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