o-nikolas commented on code in PR #37921:
URL: https://github.com/apache/airflow/pull/37921#discussion_r1513634121
##########
tests/system/providers/amazon/aws/example_neptune.py:
##########
@@ -16,45 +16,66 @@
# under the License.
from __future__ import annotations
-import pendulum
+from datetime import datetime
+from airflow.decorators import task
from airflow.models.baseoperator import chain
from airflow.models.dag import DAG
+from airflow.providers.amazon.aws.hooks.neptune import NeptuneHook
from airflow.providers.amazon.aws.operators.neptune import (
NeptuneStartDbClusterOperator,
NeptuneStopDbClusterOperator,
)
from tests.system.providers.amazon.aws.utils import SystemTestContextBuilder
DAG_ID = "example_neptune"
-# This test requires an existing Neptune cluster.
-CLUSTER_ID = "CLUSTER_ID"
-sys_test_context_task =
SystemTestContextBuilder().add_variable(CLUSTER_ID).build()
+sys_test_context_task = SystemTestContextBuilder().build()
-with DAG(DAG_ID, schedule="@once", start_date=pendulum.datetime(2024, 1, 1,
tz="UTC"), catchup=False) as dag:
+
+@task
+def create_cluster(cluster_id):
+ hook = NeptuneHook()
+ hook.conn.create_db_cluster(DBClusterIdentifier=cluster_id,
Engine="neptune", DeletionProtection=False)
+
+ hook.wait_for_cluster_availability(cluster_id=cluster_id)
Review Comment:
Tiniest of nits:
```suggestion
hook.conn.create_db_cluster(DBClusterIdentifier=cluster_id,
Engine="neptune", DeletionProtection=False)
hook.wait_for_cluster_availability(cluster_id=cluster_id)
```
--
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]