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

vincbeck 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 8bedde1bad5 Fix remote task log pollution leaking out of S3 log 
handler test (#69539)
8bedde1bad5 is described below

commit 8bedde1bad52c7d58d37e798b6ea0e7a4ca9d6f9
Author: Jason(Zhe-You) Liu <[email protected]>
AuthorDate: Tue Jul 7 23:01:52 2026 +0900

    Fix remote task log pollution leaking out of S3 log handler test (#69539)
    
    `test_read_remote_logs_with_real_s3_remote_log_io` assigns 
`_ActiveLoggingConfig.remote_task_log` directly and never restores it, so any 
log-reading test collected afterwards (e.g. test_log_reader.py when run after 
test_log_handlers.py) tries to fetch logs from the long-gone mocked S3 bucket 
and fails with InvalidAccessKeyId
---
 airflow-core/tests/unit/utils/test_log_handlers.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/airflow-core/tests/unit/utils/test_log_handlers.py 
b/airflow-core/tests/unit/utils/test_log_handlers.py
index 8248e57e4d5..b977ef0d3e0 100644
--- a/airflow-core/tests/unit/utils/test_log_handlers.py
+++ b/airflow-core/tests/unit/utils/test_log_handlers.py
@@ -665,7 +665,7 @@ class TestFileTaskLogHandler:
         assert actual == os.fspath(tmp_path / expected)
 
     @skip_if_force_lowest_dependencies_marker
-    def test_read_remote_logs_with_real_s3_remote_log_io(self, 
create_task_instance, session):
+    def test_read_remote_logs_with_real_s3_remote_log_io(self, monkeypatch, 
create_task_instance, session):
         """Test _read_remote_logs method using real S3RemoteLogIO with mock 
AWS"""
         import tempfile
 
@@ -721,7 +721,9 @@ class TestFileTaskLogHandler:
 
                     import airflow.logging_config
 
-                    
airflow.logging_config._ActiveLoggingConfig.remote_task_log = s3_remote_log_io
+                    monkeypatch.setattr(
+                        airflow.logging_config._ActiveLoggingConfig, 
"remote_task_log", s3_remote_log_io
+                    )
 
                     sources, logs = fth._read_remote_logs(ti, try_number=1)
 

Reply via email to