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 9050312ef6e Fix example_neptune_analytics system test in deferrable 
mode (#73685)
9050312ef6e is described below

commit 9050312ef6e563340afee217ac35848294419b9f
Author: Vincent <[email protected]>
AuthorDate: Thu Sep 24 16:21:14 2026 -0400

    Fix example_neptune_analytics system test in deferrable mode (#73685)
    
    neptune-graph uses account-id-based endpoints. The botocore version
    pinned by the aiobotocore extra (installed for deferrable mode) mis-signs
    those endpoints, so AWS rejects requests with 'Unable to determine
    service/operation name to be authorized'. Force the standard regional
    endpoint via account_id_endpoint_mode=disabled on every Neptune operator
    and the cleanup hook.
---
 .../system/amazon/aws/example_neptune_analytics.py      | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/providers/amazon/tests/system/amazon/aws/example_neptune_analytics.py 
b/providers/amazon/tests/system/amazon/aws/example_neptune_analytics.py
index 0e0149a7138..1fdb4e3853e 100644
--- a/providers/amazon/tests/system/amazon/aws/example_neptune_analytics.py
+++ b/providers/amazon/tests/system/amazon/aws/example_neptune_analytics.py
@@ -20,6 +20,7 @@ import contextlib
 from datetime import datetime
 
 import boto3
+from botocore.config import Config
 
 from airflow.providers.amazon.aws.hooks.neptune_analytics import 
NeptuneAnalyticsHook
 from airflow.providers.amazon.aws.operators.neptune_analytics import (
@@ -50,6 +51,12 @@ DAG_ID = "example_neptune_analytics"
 
 NEPTUNE_IMPORT_ROLE_ARN_KEY = "NEPTUNE_IMPORT_ROLE_ARN"
 
+# neptune-graph uses account-id-based endpoints. The botocore version pinned 
by the
+# aiobotocore extra (installed for deferrable mode) mis-signs those endpoints, 
so AWS
+# rejects the request with "Unable to determine service/operation name to be 
authorized".
+# Forcing the standard regional endpoint keeps the test working across 
botocore versions.
+NEPTUNE_BOTOCORE_CONFIG = {"account_id_endpoint_mode": "disabled"}
+
 sys_test_context_task = 
SystemTestContextBuilder().add_variable(NEPTUNE_IMPORT_ROLE_ARN_KEY).build()
 
 # Minimal OpenCypher CSV data for import testing.
@@ -66,7 +73,7 @@ e1,n1,n2,KNOWS
 @task(trigger_rule=TriggerRule.ALL_DONE)
 def delete_graph_if_exists(graph_name: str) -> None:
     """Safety net to clean up the graph in case a previous task failed."""
-    hook = NeptuneAnalyticsHook()
+    hook = NeptuneAnalyticsHook(config=Config(**NEPTUNE_BOTOCORE_CONFIG))
     with contextlib.suppress(Exception):
         # List graphs and find by name
         paginator = hook.conn.get_paginator("list_graphs")
@@ -151,6 +158,7 @@ with DAG(
         deferrable=False,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_create_graph]
 
@@ -159,6 +167,7 @@ with DAG(
         task_id="create_endpoint",
         graph_identifier="{{ 
ti.xcom_pull(task_ids='create_graph')['graph_id']}}",
         wait_for_completion=True,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_create_private_endpoint]
 
@@ -171,6 +180,7 @@ with DAG(
         deferrable=False,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_delete_private_endpoint]
 
@@ -186,6 +196,7 @@ with DAG(
         deferrable=False,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_start_import_task]
 
@@ -195,6 +206,7 @@ with DAG(
         import_task_id="{{ 
ti.xcom_pull(task_ids='start_import')['import_task_id']}}",
         wait_for_completion=True,
         aws_conn_id="aws_default",
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_cancel_import_task]
 
@@ -207,6 +219,7 @@ with DAG(
         deferrable=False,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_delete_graph]
 
@@ -228,6 +241,7 @@ with DAG(
         deferrable=False,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_create_graph_with_import]
 
@@ -241,6 +255,7 @@ with DAG(
         trigger_rule=TriggerRule.ALL_DONE,
         waiter_delay=30,
         waiter_max_attempts=60,
+        botocore_config=NEPTUNE_BOTOCORE_CONFIG,
     )
     # [END howto_operator_neptune_analytics_delete_import_graph]
 

Reply via email to