Support non-live database migration (#72433)
* Support non-live database migration * Tweak startup order, add test * Address review comments * Fix typo * Clarify comment about promoting dependencies * Tweak * Fix merge mistake * Fix some tests * Fix additional test * Fix additional test * Adjust tests * Improve test coverage
This commit is contained in:
parent
9d0a252ca7
commit
fd6ffef52f
20 changed files with 993 additions and 61 deletions
|
@ -31,6 +31,7 @@ from homeassistant.components.recorder.util import session_scope
|
|||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import recorder as recorder_helper
|
||||
from homeassistant.setup import setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
@ -1128,6 +1129,7 @@ def test_delete_metadata_duplicates(caplog, tmpdir):
|
|||
"homeassistant.components.recorder.core.create_engine", new=_create_engine_28
|
||||
):
|
||||
hass = get_test_home_assistant()
|
||||
recorder_helper.async_initialize_recorder(hass)
|
||||
setup_component(hass, "recorder", {"recorder": {"db_url": dburl}})
|
||||
wait_recording_done(hass)
|
||||
wait_recording_done(hass)
|
||||
|
@ -1158,6 +1160,7 @@ def test_delete_metadata_duplicates(caplog, tmpdir):
|
|||
|
||||
# Test that the duplicates are removed during migration from schema 28
|
||||
hass = get_test_home_assistant()
|
||||
recorder_helper.async_initialize_recorder(hass)
|
||||
setup_component(hass, "recorder", {"recorder": {"db_url": dburl}})
|
||||
hass.start()
|
||||
wait_recording_done(hass)
|
||||
|
@ -1217,6 +1220,7 @@ def test_delete_metadata_duplicates_many(caplog, tmpdir):
|
|||
"homeassistant.components.recorder.core.create_engine", new=_create_engine_28
|
||||
):
|
||||
hass = get_test_home_assistant()
|
||||
recorder_helper.async_initialize_recorder(hass)
|
||||
setup_component(hass, "recorder", {"recorder": {"db_url": dburl}})
|
||||
wait_recording_done(hass)
|
||||
wait_recording_done(hass)
|
||||
|
@ -1249,6 +1253,7 @@ def test_delete_metadata_duplicates_many(caplog, tmpdir):
|
|||
|
||||
# Test that the duplicates are removed during migration from schema 28
|
||||
hass = get_test_home_assistant()
|
||||
recorder_helper.async_initialize_recorder(hass)
|
||||
setup_component(hass, "recorder", {"recorder": {"db_url": dburl}})
|
||||
hass.start()
|
||||
wait_recording_done(hass)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue