mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Always use a commit interval of 0 for the in memory db in tests (#69330)
This commit is contained in:
parent
c8df2656b1
commit
bde3646293
@ -915,7 +915,7 @@ def init_recorder_component(hass, add_config=None):
|
||||
|
||||
async def async_init_recorder_component(hass, add_config=None):
|
||||
"""Initialize the recorder asynchronously."""
|
||||
config = add_config or {}
|
||||
config = add_config or {recorder.CONF_COMMIT_INTERVAL: 0}
|
||||
if recorder.CONF_DB_URL not in config:
|
||||
config[recorder.CONF_DB_URL] = "sqlite://"
|
||||
|
||||
|
@ -185,7 +185,9 @@ async def test_saving_many_states(
|
||||
hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT
|
||||
):
|
||||
"""Test we expire after many commits."""
|
||||
instance = await async_setup_recorder_instance(hass)
|
||||
instance = await async_setup_recorder_instance(
|
||||
hass, {recorder.CONF_COMMIT_INTERVAL: 1}
|
||||
)
|
||||
|
||||
entity_id = "test.recorder"
|
||||
attributes = {"test_attr": 5, "test_attr_10": "nice"}
|
||||
|
@ -97,7 +97,7 @@ def test_validate_or_move_away_sqlite_database(hass, tmpdir, caplog):
|
||||
|
||||
async def test_last_run_was_recently_clean(hass):
|
||||
"""Test we can check if the last recorder run was recently clean."""
|
||||
await async_init_recorder_component(hass)
|
||||
await async_init_recorder_component(hass, {recorder.CONF_COMMIT_INTERVAL: 1})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
cursor = hass.data[DATA_INSTANCE].engine.raw_connection().cursor()
|
||||
|
Loading…
x
Reference in New Issue
Block a user