Ensure a wal checkpoint is scheduled nightly (#50746)

This commit is contained in:
J. Nick Koston 2021-05-17 17:27:51 -04:00 committed by GitHub
parent b1ff9dc45e
commit e7f7e61e88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 8 deletions

View file

@ -269,3 +269,11 @@ def test_end_incomplete_runs(hass_recorder, caplog):
assert run_info.end == now_without_tz
assert "Ended unfinished session" in caplog.text
def test_perodic_db_cleanups(hass_recorder):
"""Test perodic db cleanups."""
hass = hass_recorder()
with patch.object(hass.data[DATA_INSTANCE].engine, "execute") as execute_mock:
util.perodic_db_cleanups(hass.data[DATA_INSTANCE])
assert execute_mock.call_args[0][0] == "PRAGMA wal_checkpoint(TRUNCATE);"