This is an automated email from the ASF dual-hosted git repository.

rahulvats pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 741439075ce Reduce verbose OTel output in integration test CI logs 
(#63731)
741439075ce is described below

commit 741439075ce78bb6c0d808907b49562b12980db1
Author: Daniel Standish <[email protected]>
AuthorDate: Tue Mar 17 00:13:45 2026 -0700

    Reduce verbose OTel output in integration test CI logs (#63731)
    
    Scheduler and api-server subprocesses were started with stdout/stderr
    inheriting the parent process fd, causing all OTel console metrics JSON
    (emitted every 5s) to flood pytest's captured output. On test failure,
    pytest would dump the entire captured stdout — tens of thousands of lines —
    making logs nearly unreadable.
    
    - In `start_scheduler`, default stdout/stderr to DEVNULL; pass
      `capture_output=True` only from `dag_execution_for_testing_metrics`
      which actually needs to parse the console metrics output.
    - Remove the debug `log.info("out-start...")` calls that re-emitted the
      full captured output back into test stdout unnecessarily.
    
    Made-with: Cursor
---
 airflow-core/tests/integration/otel/test_otel.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/airflow-core/tests/integration/otel/test_otel.py 
b/airflow-core/tests/integration/otel/test_otel.py
index 60af1060ce1..c9bd4ad8b78 100644
--- a/airflow-core/tests/integration/otel/test_otel.py
+++ b/airflow-core/tests/integration/otel/test_otel.py
@@ -317,7 +317,7 @@ class TestOtelIntegration:
         try:
             # Start the processes here and not as fixtures or in a common 
setup,
             # so that the test can capture their output.
-            scheduler_process, apiserver_process = self.start_scheduler()
+            scheduler_process, apiserver_process = 
self.start_scheduler(capture_output=True)
 
             dag_id = "otel_test_dag"
 
@@ -363,10 +363,7 @@ class TestOtelIntegration:
                 "The apiserver process status is None, which means that it 
hasn't terminated as expected."
             )
 
-        out, err = capfd.readouterr()
-        log.info("out-start --\n%s\n-- out-end", out)
-        log.info("err-start --\n%s\n-- err-end", err)
-
+        out, _err = capfd.readouterr()
         return out, dag
 
     def _get_ti(self, dag_id: str, run_id: str, task_id: str) -> Any | None:
@@ -482,9 +479,7 @@ class TestOtelIntegration:
                 "The apiserver process status is None, which means that it 
hasn't terminated as expected."
             )
 
-        out, err = capfd.readouterr()
-        log.info("out-start --\n%s\n-- out-end", out)
-        log.info("err-start --\n%s\n-- err-end", err)
+        capfd.readouterr()
 
         host = "jaeger"
         service_name = os.environ.get("OTEL_SERVICE_NAME", "test")
@@ -513,19 +508,22 @@ class TestOtelIntegration:
             "dag_run.otel_test_dag": None,
         }
 
-    def start_scheduler(self):
+    def start_scheduler(self, capture_output: bool = False):
+        stdout = None if capture_output else subprocess.DEVNULL
+        stderr = None if capture_output else subprocess.DEVNULL
+
         scheduler_process = subprocess.Popen(
             self.scheduler_command_args,
             env=os.environ.copy(),
-            stdout=None,
-            stderr=None,
+            stdout=stdout,
+            stderr=stderr,
         )
 
         apiserver_process = subprocess.Popen(
             self.apiserver_command_args,
             env=os.environ.copy(),
-            stdout=None,
-            stderr=None,
+            stdout=stdout,
+            stderr=stderr,
         )
 
         # Wait to ensure both processes have started.

Reply via email to