This is an automated email from the ASF dual-hosted git repository.
shahar1 pushed a commit to branch airflow-ctl/v0-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/airflow-ctl/v0-1-test by this
push:
new f4629fedf09 [airflow-ctl/v0-1-test] Stop airflowctl connection-refused
test depending on the local network (#76077) (#76082)
f4629fedf09 is described below
commit f4629fedf09b9baca350f50821a29b48753ccd0b
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Oct 30 22:56:30 2026 +0200
[airflow-ctl/v0-1-test] Stop airflowctl connection-refused test depending
on the local network (#76077) (#76082)
test_server_connection_refused connected to http://localhost and expected
the kernel to refuse it. That fails on any machine where something listens
on port 80, and on WSL2 with mirrored networking, where a closed loopback
port times out instead of refusing. The test now raises the ConnectError
from a mock transport, which still exercises the conversion to
AirflowCtlConnectionException.
(cherry picked from commit e211b4511486e9345fb7afdc7ad2288a43b2b491)
Co-authored-by: Shahar Epstein <[email protected]>
---
airflow-ctl/tests/airflow_ctl/api/test_operations.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index 80c8173bf52..9e510c55f63 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -154,7 +154,12 @@ class TestBaseOperations:
}
def test_server_connection_refused(self):
- client = make_api_client(base_url="http://localhost")
+ # A real connect to localhost depends on the machine: a local web
server answers, and WSL2
+ # mirrored networking turns a closed loopback port into a timeout
instead of a refusal.
+ def handle_request(request: httpx.Request) -> httpx.Response:
+ raise httpx.ConnectError("[Errno 111] Connection refused",
request=request)
+
+ client = make_api_client(transport=httpx.MockTransport(handle_request))
with pytest.raises(
AirflowCtlConnectionException, match="Connection refused. Is the
API server running?"
):