core/tests/components/recorder
Stefan Agner f0006b92be
Allow to lock SQLite database during backup (#60874)
* Allow to set CONF_DB_URL

This is useful for test which need a custom DB path.

* Introduce write_lock_db helper to lock SQLite database

* Introduce Websocket API which allows to lock database during backup

* Fix isort

* Avoid mutable default arguments

* Address pylint issues

* Avoid holding executor thread

* Set unlock event in case timeout occures

This makes sure the database is left unlocked even in case of a race
condition.

* Add more unit tests

* Address new pylint errors

* Lower timeout to speedup tests

* Introduce queue overflow test

* Unlock database if necessary

This makes sure that the test runs through in case locking actually
succeeds (and the test fails).

* Make DB_LOCK_TIMEOUT a global

There is no good reason for this to be an argument. The recorder needs
to pick a sensible value.

* Add Websocket Timeout test

* Test lock_database() return

* Update homeassistant/components/recorder/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix format

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-12-07 13:16:24 +01:00
..
__init__.py
common.py Improve recorder migration tests (#59075) 2021-11-04 20:21:38 -07:00
conftest.py Add 5-minute statistics for sensors (#56006) 2021-09-16 10:57:15 +02:00
models_schema_0.py Improve recorder migration tests (#59075) 2021-11-04 20:21:38 -07:00
models_schema_16.py Improve recorder migration tests (#59075) 2021-11-04 20:21:38 -07:00
models_schema_18.py Improve recorder migration tests (#59075) 2021-11-04 20:21:38 -07:00
models_schema_22.py Improve recorder migration tests (#59075) 2021-11-04 20:21:38 -07:00
test_history.py Optimize _get_states_with_session (#56734) 2021-09-29 17:08:27 +02:00
test_init.py Allow to lock SQLite database during backup (#60874) 2021-12-07 13:16:24 +01:00
test_migrate.py Adjust recorder tests according to #59087 (#59143) 2021-11-05 10:49:58 +01:00
test_models.py
test_pool.py
test_purge.py Purge short term statistics (#58028) 2021-10-20 16:00:59 +02:00
test_statistics.py Correct end time for monthly statistics summary (#59551) 2021-11-12 15:01:40 +01:00
test_util.py Allow to lock SQLite database during backup (#60874) 2021-12-07 13:16:24 +01:00
test_websocket_api.py Allow to lock SQLite database during backup (#60874) 2021-12-07 13:16:24 +01:00