Lee-W commented on code in PR #64888:
URL: https://github.com/apache/airflow/pull/64888#discussion_r3098289443
##########
airflow-core/tests/unit/core/test_sqlalchemy_config.py:
##########
@@ -70,6 +70,53 @@ def test_configure_orm_with_default_values(
**expected_kwargs,
)
+ @patch("airflow.settings.setup_event_handlers")
+ @patch("airflow.settings.scoped_session")
+ @patch("airflow.settings.sessionmaker")
+ @patch("airflow.settings.create_engine")
+ def test_configure_orm_sqlite_file_based_gets_pool_settings(
+ self,
+ mock_create_engine,
+ mock_sessionmaker,
+ mock_scoped_session,
+ mock_setup_event_handlers,
+ monkeypatch,
+ ):
+ """SQLAlchemy 2.0+ uses QueuePool for file-based SQLite, so pool
settings should be applied."""
+ monkeypatch.setattr(settings, "SQL_ALCHEMY_CONN",
"sqlite:////tmp/airflow.db")
+ settings.configure_orm()
+ expected_kwargs = dict(
+ connect_args={"check_same_thread": False},
+ max_overflow=10,
+ pool_pre_ping=True,
+ pool_recycle=1800,
+ pool_size=5,
+ future=True,
+ )
+ mock_create_engine.assert_called_once_with(
+ "sqlite:////tmp/airflow.db",
+ **expected_kwargs,
+ )
Review Comment:
```suggestion
assert mock_create_engine.mock_calls == [
call(
"sqlite:////tmp/airflow.db",
**expected_kwargs,
)
]
```
nit: non-blocking
--
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]