Fix flaky recorder migration tests (#123971)

This commit is contained in:
Erik Montnemery 2024-08-15 10:32:40 +02:00 committed by GitHub
parent 5836f8edb5
commit 81c4bb5f72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(),
) )