bbovenzi commented on code in PR #66421:
URL: https://github.com/apache/airflow/pull/66421#discussion_r3189151563


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.test.tsx:
##########
@@ -134,6 +134,253 @@ describe("Task log grouping", () => {
     await waitFor(() => expect(screen.queryByText(/Marking task as 
SUCCESS/iu)).not.toBeVisible());
   }, 10_000);
 
+  it("renders nested groups correctly", async () => {
+    render(
+      <AppWrapper 
initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/generate"]}
 />,
+    );
+
+    await waitForLogs();
+
+    // The nested group "Dependency check details" should have a header
+    // First expand the parent group "Pre task execution logs"
+    const summaryPre = screen.getByTestId("summary-Pre task execution logs");
+
+    fireEvent.click(summaryPre);
+
+    // The nested group header should now be visible
+    await waitFor(() => expect(screen.getByTestId("summary-Dependency check 
details")).toBeInTheDocument());
+
+    // But nested group content is collapsed
+    expect(screen.queryByText(/dep_context=non-requeueable/iu)).toBeNull();
+
+    // Expand the nested group
+    fireEvent.click(screen.getByTestId("summary-Dependency check details"));
+    await waitFor(() => 
expect(screen.getByText(/dep_context=non-requeueable/iu)).toBeInTheDocument());
+  }, 10_000);
+});
+
+describe("Task Identity preamble", () => {
+  it("renders Task Identity preamble after the Log message source details 
group", async () => {
+    render(
+      <AppWrapper 
initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/ti_context"]}
 />,
+    );
+
+    await waitForLogs();
+
+    const sourceGroup = screen.getByTestId(
+      'summary-Log message source details 
sources=["/home/airflow/logs/dag_id=log_grouping/run_id=manual__2025-02-18T12:19/task_id=ti_context/attempt=1.log"]',
+    );
+
+    expect(sourceGroup).toBeInTheDocument();
+
+    // Task Identity preamble should be visible
+    expect(screen.getByText("Task Identity")).toBeInTheDocument();
+    expect(screen.getByText("ti_id")).toBeInTheDocument();
+    // Value is a text node adjacent to =; match via partial text
+    
expect(screen.getByText(/01951900-16f6-7c1c-ae66-91bdfe9e0cfd/u)).toBeInTheDocument();
+
+    // Preamble should come after the source details group in DOM order.
+    const preamble = screen.getByText("Task Identity");
+
+    expect(preamble).toBeInTheDocument();
+    expect(sourceGroup).toBeInTheDocument();
+
+    // DOCUMENT_POSITION_FOLLOWING (4) is set when preamble comes after the 
source group summary
+    // eslint-disable-next-line no-bitwise
+    expect(sourceGroup.compareDocumentPosition(preamble) & 
Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+  });
+
+  it("does not render TI context fields on individual log lines", async () => {
+    render(
+      <AppWrapper 
initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/ti_context"]}
 />,
+    );
+
+    await waitForLogs();
+
+    const taskStarted = screen.getByText("Task 
started").closest('[data-testid^="virtualized-item-"]');
+
+    expect(taskStarted).toBeInTheDocument();
+
+    if (taskStarted !== null) {
+      expect(taskStarted.querySelector('[data-key="ti_id"]')).toBeNull();
+      expect(taskStarted.querySelector('[data-key="dag_id"]')).toBeNull();
+      expect(taskStarted.querySelector('[data-key="run_id"]')).toBeNull();
+    }
+  });
+});
+
+describe("Task log search", () => {

Review Comment:
   You can remove all the task log search tests. It is only in 3.3



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