amoghrajesh commented on code in PR #60826:
URL: https://github.com/apache/airflow/pull/60826#discussion_r2719525953
##########
task-sdk/tests/task_sdk/execution_time/test_supervisor.py:
##########
@@ -2994,25 +2999,31 @@ def get_connection(self, conn_id: str):
backend = ExampleBackend()
monkeypatch.setattr(supervisor, "ensure_secrets_backend_loaded", lambda:
[backend])
- monkeypatch.setattr(sdk_log, "load_remote_log_handler", lambda: object())
- monkeypatch.setattr(sdk_log, "load_remote_conn_id", lambda: "test_conn")
monkeypatch.delenv("AIRFLOW_CONN_TEST_CONN", raising=False)
- def noop_request(request: httpx.Request) -> httpx.Response:
- return httpx.Response(200)
-
- clients = []
- for _ in range(3):
- client = make_client(transport=httpx.MockTransport(noop_request))
- clients.append(weakref.ref(client))
- with _remote_logging_conn(client):
- pass
- client.close()
- del client
-
- gc.collect()
- assert backend.calls == 1, "Connection should be cached, not fetched
multiple times"
- assert all(ref() is None for ref in clients), "Client instances should be
garbage collected"
+ with conf_vars(
+ {
+ ("logging", "remote_logging"): "True",
+ ("logging", "remote_base_log_folder"): "s3://bucket/logs",
+ ("logging", "remote_log_conn_id"): "test_conn",
+ }
+ ):
Review Comment:
Instead of patching `load_remote_log_handler` and `load_remote_conn_id`, we
can just populate the right env's and rest will be handled by the code called
when `_remote_logging_conn` is called.
--
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]