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 df584691052 Fix Amazon system tests creating connections on Airflow 2 
(#73571)
df584691052 is described below

commit df58469105225cae144d65a9f390cc0bd2efd98d
Author: Vincent <[email protected]>
AuthorDate: Wed Sep 23 13:48:08 2026 -0400

    Fix Amazon system tests creating connections on Airflow 2 (#73571)
    
    These Dags created their Airflow connection through the REST API, which only
    exists in Airflow 3, so on Airflow 2 the setup task kept retrying against a
    non-existent API server until it failed. The shared test helper already 
knows
    how to create a connection on both versions.
---
 .../system/amazon/aws/example_google_api_youtube_to_s3.py  | 10 ++++------
 .../amazon/tests/system/amazon/aws/example_http_to_s3.py   | 14 ++++----------
 .../amazon/tests/system/amazon/aws/example_s3_to_sql.py    | 10 ++++------
 .../amazon/tests/system/amazon/aws/example_sql_to_s3.py    | 10 ++++------
 4 files changed, 16 insertions(+), 28 deletions(-)

diff --git 
a/providers/amazon/tests/system/amazon/aws/example_google_api_youtube_to_s3.py 
b/providers/amazon/tests/system/amazon/aws/example_google_api_youtube_to_s3.py
index a8e2482dbbc..b058cc29028 100644
--- 
a/providers/amazon/tests/system/amazon/aws/example_google_api_youtube_to_s3.py
+++ 
b/providers/amazon/tests/system/amazon/aws/example_google_api_youtube_to_s3.py
@@ -73,7 +73,7 @@ except ImportError:
     from airflow.utils.trigger_rule import TriggerRule  # type: 
ignore[no-redef,attr-defined]
 
 from system.amazon.aws.utils import ENV_ID_KEY, SystemTestContextBuilder
-from tests_common.test_utils.api_client_helpers import 
make_authenticated_rest_api_request
+from tests_common.test_utils.api_client_helpers import 
create_airflow_connection
 
 DAG_ID = "example_google_api_youtube_to_s3"
 
@@ -96,11 +96,9 @@ def create_connection_gcp(conn_id_name: str, secret_arn: 
str):
         "project": "aws-oss-airflow",
         "keyfile_dict": json_data,
     }
-    make_authenticated_rest_api_request(
-        path="/api/v2/connections",
-        method="POST",
-        body={
-            "connection_id": conn_id_name,
+    create_airflow_connection(
+        connection_id=conn_id_name,
+        connection_conf={
             "conn_type": "google_cloud_platform",
             "extra": json.dumps(conn_extra),
         },
diff --git a/providers/amazon/tests/system/amazon/aws/example_http_to_s3.py 
b/providers/amazon/tests/system/amazon/aws/example_http_to_s3.py
index 9389c7f0673..ca0fd437ef1 100644
--- a/providers/amazon/tests/system/amazon/aws/example_http_to_s3.py
+++ b/providers/amazon/tests/system/amazon/aws/example_http_to_s3.py
@@ -27,7 +27,7 @@ except ImportError:
     # Fallback for older Airflow versions
     from airflow.operators.bash import BashOperator  # type: ignore[no-redef]
 
-from tests_common.test_utils.api_client_helpers import 
make_authenticated_rest_api_request
+from tests_common.test_utils.api_client_helpers import 
create_airflow_connection
 from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
 
 if AIRFLOW_V_3_0_PLUS:
@@ -66,15 +66,9 @@ exit 0
 
 @task
 def create_connection(conn_id_name: str):
-    make_authenticated_rest_api_request(
-        path="/api/v2/connections",
-        method="POST",
-        body={
-            "connection_id": conn_id_name,
-            "conn_type": "http",
-            "host": "localhost",
-            "port": 8083,
-        },
+    create_airflow_connection(
+        connection_id=conn_id_name,
+        connection_conf={"conn_type": "http", "host": "localhost", "port": 
8083},
     )
 
 
diff --git a/providers/amazon/tests/system/amazon/aws/example_s3_to_sql.py 
b/providers/amazon/tests/system/amazon/aws/example_s3_to_sql.py
index df15e1ba0fd..ae6e1294e77 100644
--- a/providers/amazon/tests/system/amazon/aws/example_s3_to_sql.py
+++ b/providers/amazon/tests/system/amazon/aws/example_s3_to_sql.py
@@ -51,7 +51,7 @@ except ImportError:
     from airflow.utils.trigger_rule import TriggerRule  # type: 
ignore[no-redef,attr-defined]
 
 from system.amazon.aws.utils import ENV_ID_KEY, SystemTestContextBuilder
-from tests_common.test_utils.api_client_helpers import 
make_authenticated_rest_api_request
+from tests_common.test_utils.api_client_helpers import 
create_airflow_connection
 from tests_common.test_utils.watcher import watcher
 
 # Externally fetched variables:
@@ -79,11 +79,9 @@ SAMPLE_DATA = r"""1,Caipirinha,Cachaca
 @task
 def create_connection(conn_id_name: str, cluster_id: str):
     cluster_endpoint = 
RedshiftHook().conn.describe_clusters(ClusterIdentifier=cluster_id)["Clusters"][0]
-    make_authenticated_rest_api_request(
-        path="/api/v2/connections",
-        method="POST",
-        body={
-            "connection_id": conn_id_name,
+    create_airflow_connection(
+        connection_id=conn_id_name,
+        connection_conf={
             "conn_type": "redshift",
             "host": cluster_endpoint["Endpoint"]["Address"],
             "login": DB_LOGIN,
diff --git a/providers/amazon/tests/system/amazon/aws/example_sql_to_s3.py 
b/providers/amazon/tests/system/amazon/aws/example_sql_to_s3.py
index cffda6c3ba0..103501e14aa 100644
--- a/providers/amazon/tests/system/amazon/aws/example_sql_to_s3.py
+++ b/providers/amazon/tests/system/amazon/aws/example_sql_to_s3.py
@@ -47,7 +47,7 @@ except ImportError:
     from airflow.utils.trigger_rule import TriggerRule  # type: 
ignore[no-redef,attr-defined]
 
 from system.amazon.aws.utils import ENV_ID_KEY, SystemTestContextBuilder
-from tests_common.test_utils.api_client_helpers import 
make_authenticated_rest_api_request
+from tests_common.test_utils.api_client_helpers import 
create_airflow_connection
 
 DAG_ID = "example_sql_to_s3"
 
@@ -81,11 +81,9 @@ SQL_INSERT_DATA = f"INSERT INTO {REDSHIFT_TABLE} VALUES ( 1, 
'Banana', 'Yellow')
 def create_connection(conn_id_name: str, cluster_id: str):
     redshift_hook = RedshiftHook()
     cluster_endpoint = 
redshift_hook.get_conn().describe_clusters(ClusterIdentifier=cluster_id)["Clusters"][0]
-    make_authenticated_rest_api_request(
-        path="/api/v2/connections",
-        method="POST",
-        body={
-            "connection_id": conn_id_name,
+    create_airflow_connection(
+        connection_id=conn_id_name,
+        connection_conf={
             "conn_type": "redshift",
             "host": cluster_endpoint["Endpoint"]["Address"],
             "login": DB_LOGIN,

Reply via email to