mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix flaky recorder migration tests (#123971)
This commit is contained in:
parent
5836f8edb5
commit
81c4bb5f72
@ -68,7 +68,7 @@ class InstrumentedMigration:
|
|||||||
non_live_migration_done: threading.Event
|
non_live_migration_done: threading.Event
|
||||||
non_live_migration_done_stall: threading.Event
|
non_live_migration_done_stall: threading.Event
|
||||||
apply_update_mock: Mock
|
apply_update_mock: Mock
|
||||||
stall_on_schema_version: int
|
stall_on_schema_version: int | None
|
||||||
apply_update_stalled: threading.Event
|
apply_update_stalled: threading.Event
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +147,8 @@ def instrument_migration(
|
|||||||
old_version: int,
|
old_version: int,
|
||||||
):
|
):
|
||||||
"""Control migration progress."""
|
"""Control migration progress."""
|
||||||
if new_version == instrumented_migration.stall_on_schema_version:
|
stall_version = instrumented_migration.stall_on_schema_version
|
||||||
|
if stall_version is None or stall_version == new_version:
|
||||||
instrumented_migration.apply_update_stalled.set()
|
instrumented_migration.apply_update_stalled.set()
|
||||||
instrumented_migration.migration_stall.wait()
|
instrumented_migration.migration_stall.wait()
|
||||||
real_apply_update(
|
real_apply_update(
|
||||||
@ -179,7 +180,7 @@ def instrument_migration(
|
|||||||
non_live_migration_done=threading.Event(),
|
non_live_migration_done=threading.Event(),
|
||||||
non_live_migration_done_stall=threading.Event(),
|
non_live_migration_done_stall=threading.Event(),
|
||||||
apply_update_mock=apply_update_mock,
|
apply_update_mock=apply_update_mock,
|
||||||
stall_on_schema_version=1,
|
stall_on_schema_version=None,
|
||||||
apply_update_stalled=threading.Event(),
|
apply_update_stalled=threading.Event(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user