kaxil commented on code in PR #44330:
URL: https://github.com/apache/airflow/pull/44330#discussion_r1862842432


##########
providers/tests/edge/worker_api/routes/test_logs.py:
##########
@@ -0,0 +1,78 @@
+# 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
+
+from typing import TYPE_CHECKING
+
+import pytest
+
+from airflow.operators.empty import EmptyOperator
+from airflow.providers.edge.models.edge_logs import EdgeLogsModel
+from airflow.providers.edge.worker_api.datamodels import PushLogsBody
+from airflow.providers.edge.worker_api.routes.logs import logfile_path, 
push_logs
+from airflow.utils import timezone
+
+if TYPE_CHECKING:
+    from sqlalchemy.orm import Session
+
+pytestmark = pytest.mark.db_test
+
+
+DAG_ID = "my_dag"
+TASK_ID = "my_task"
+RUN_ID = "manual__2024-11-24T21:03:01+01:00"
+
+
+class TestLogsApiRoutes:
+    @pytest.fixture(autouse=True)
+    def setup_test_cases(self, dag_maker, session: Session):
+        with dag_maker(DAG_ID):
+            EmptyOperator(task_id=TASK_ID)
+        dag_maker.create_dagrun(run_id=RUN_ID)
+
+        session.query(EdgeLogsModel).delete()
+        session.commit()
+
+    def test_logfile_path(self, session: Session):
+        p: str = logfile_path(dag_id=DAG_ID, task_id=TASK_ID, run_id=RUN_ID, 
try_number=1, map_index=-1)
+        assert p
+        assert f"dag_id={DAG_ID}/" in p
+        assert f"/task_id={TASK_ID}/" in p
+        assert f"/run_id={RUN_ID}/" in p
+        assert "/attempt=1" in p
+        assert "/-1" not in p

Review Comment:
   Why assert like this? instead of a single str with full path?



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