mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Don't allow in-memory SQLite database (#69616)
This commit is contained in:
@@ -910,10 +910,16 @@ def init_recorder_component(hass, add_config=None):
|
||||
if recorder.CONF_COMMIT_INTERVAL not in config:
|
||||
config[recorder.CONF_COMMIT_INTERVAL] = 0
|
||||
|
||||
with patch("homeassistant.components.recorder.migration.migrate_schema"):
|
||||
with patch(
|
||||
"homeassistant.components.recorder.ALLOW_IN_MEMORY_DB",
|
||||
True,
|
||||
), patch("homeassistant.components.recorder.migration.migrate_schema"):
|
||||
assert setup_component(hass, recorder.DOMAIN, {recorder.DOMAIN: config})
|
||||
assert recorder.DOMAIN in hass.config.components
|
||||
_LOGGER.info("In-memory recorder successfully started")
|
||||
_LOGGER.info(
|
||||
"Test recorder successfully started, database location: %s",
|
||||
config[recorder.CONF_DB_URL],
|
||||
)
|
||||
|
||||
|
||||
async def async_init_recorder_component(hass, add_config=None):
|
||||
@@ -924,12 +930,18 @@ async def async_init_recorder_component(hass, add_config=None):
|
||||
if recorder.CONF_COMMIT_INTERVAL not in config:
|
||||
config[recorder.CONF_COMMIT_INTERVAL] = 0
|
||||
|
||||
with patch("homeassistant.components.recorder.migration.migrate_schema"):
|
||||
with patch(
|
||||
"homeassistant.components.recorder.ALLOW_IN_MEMORY_DB",
|
||||
True,
|
||||
), patch("homeassistant.components.recorder.migration.migrate_schema"):
|
||||
assert await async_setup_component(
|
||||
hass, recorder.DOMAIN, {recorder.DOMAIN: config}
|
||||
)
|
||||
assert recorder.DOMAIN in hass.config.components
|
||||
_LOGGER.info("In-memory recorder successfully started")
|
||||
_LOGGER.info(
|
||||
"Test recorder successfully started, database location: %s",
|
||||
config[recorder.CONF_DB_URL],
|
||||
)
|
||||
|
||||
|
||||
def mock_restore_cache(hass, states):
|
||||
|
||||
Reference in New Issue
Block a user