You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2026/10/19 15:28:23 UTC

(airflow) branch main updated: Fix Hive invalid-port tests after core connection port validation (#75119)

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

potiuk 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 e26dcc0e005 Fix Hive invalid-port tests after core connection port validation (#75119)
e26dcc0e005 is described below

commit e26dcc0e0053dc9d27bdc51cddf4b39f5b03337f
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Oct 19 17:28:13 2026 +0200

    Fix Hive invalid-port tests after core connection port validation (#75119)
    
    Core Connection now validates the port when it is set (#74461), so the
    test failed while building the connection, before the hook's own
    beeline-parameter check, which still guards older Airflow cores, could
    run.
    
    Generated-by: Claude Opus 5
---
 .../apache/hive/tests/unit/apache/hive/hooks/test_hive.py      | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py b/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
index 314cdc144a0..dce595958d7 100644
--- a/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
+++ b/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
@@ -853,13 +853,9 @@ class TestHiveServer2Hook:
         ],
     )
     def test_get_conn_with_wrong_connection_parameters(self, host, port, schema, message):
-        connection = Connection(
-            conn_id="test",
-            conn_type="hive",
-            host=host,
-            port=port,
-            schema=schema,
-        )
+        # Newer core Connection rejects invalid ports on assignment; a spec'd mock lets the hook's own
+        # check, which still guards older Airflow versions, see them.
+        connection = mock.Mock(spec=Connection, conn_id="test", host=host, port=port, schema=schema)
         hook = HiveCliHook()
         if message:
             with pytest.raises(Exception, match=message):