Always use a commit interval of 0 for the in memory db in tests (#69330)

This commit is contained in:
J. Nick Koston 2022-04-05 12:06:06 -10:00 committed by GitHub
parent c8df2656b1
commit bde3646293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -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://"

View File

@ -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"}

View File

@ -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()