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


##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -1030,6 +1033,41 @@ def test_ti_run_populates_team_name(
         assert response.status_code == 200
         assert response.json()["dag_run"]["team_name"] == (team_name if 
expect_team else None)
 
+    def test_ti_run_populates_log_id_template(
+        self, client, session, create_task_instance, create_log_template, 
time_machine
+    ):
+        """``log_id_template`` echoes the LogTemplate row pinned to the Dag 
run."""
+        instant = timezone.parse("2024-09-30T12:00:00Z")
+        time_machine.move_to(instant, tick=False)
+
+        custom_elasticsearch_id = 
"{dag_id}-{task_id}-{logical_date}-{try_number}"
+        create_log_template("{{ ti.dag_id }}.log", custom_elasticsearch_id)
+
+        # The Dag run pins the newest LogTemplate row at creation time.
+        ti = create_task_instance(
+            task_id="test_ti_run_populates_log_id_template",
+            state=State.QUEUED,
+            dagrun_state=DagRunState.RUNNING,
+            session=session,
+            start_date=instant,
+            dag_id=str(uuid4()),
+        )
+        session.commit()

Review Comment:
   Good idea! Rather than extending this test case, I'd prefer to add a new one 
that starts with a loop to exercise the scenario where the API returns a new 
expected log template whenever there's an update. I just added in 
https://github.com/apache/airflow/pull/69688/changes/3bd771134a087a3123274bd63521c4ccf038f67b



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