Use database executor in migration test (#70774)

pull/70466/head^2
J. Nick Koston 2022-04-26 04:42:28 -10:00 committed by GitHub
parent 97af164858
commit 89e3a48751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -193,7 +193,9 @@ async def test_events_during_migration_are_queued(hass):
await async_wait_recording_done(hass)
assert recorder.util.async_migration_in_progress(hass) is False
db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity")
db_states = await recorder.get_instance(hass).async_add_executor_job(
_get_native_states, hass, "my.entity"
)
assert len(db_states) == 2
@ -221,11 +223,15 @@ async def test_events_during_migration_queue_exhausted(hass):
await async_wait_recording_done(hass)
assert recorder.util.async_migration_in_progress(hass) is False
db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity")
db_states = await recorder.get_instance(hass).async_add_executor_job(
_get_native_states, hass, "my.entity"
)
assert len(db_states) == 1
hass.states.async_set("my.entity", "on", {})
await async_wait_recording_done(hass)
db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity")
db_states = await recorder.get_instance(hass).async_add_executor_job(
_get_native_states, hass, "my.entity"
)
assert len(db_states) == 2