amoghrajesh commented on code in PR #52129:
URL: https://github.com/apache/airflow/pull/52129#discussion_r2163231642


##########
airflow-core/src/airflow/utils/db.py:
##########
@@ -125,9 +125,30 @@ def add_default_pool_if_not_exists(session: Session = 
NEW_SESSION):
 @provide_session
 def create_default_connections(session: Session = NEW_SESSION):
     """Create default Airflow connections."""
+    conns = get_default_connections()
+
+    for c in conns:
+        merge_conn(c, session)
+
+
+def create_default_connections_for_tests():
+    """
+    Create default Airflow connections for tests.
+
+    For testing purposes, we do not need to have the connections setup in the 
database, using environment
+    variables instead would provide better lookup speeds and is easier too.
+    """
+    conns = get_default_connections()
+
+    for c in conns:
+        envvar = f"AIRFLOW_CONN_{c.conn_id.upper()}"
+        os.environ[envvar] = c.as_json()

Review Comment:
   Of course! That would only make sense



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to