mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
Fix flaky test_harvester_restart timing assertion (#20772)
Fix flaky test_harvester_restart by awaiting receiver cleanup Replace a bare `assert` with `time_out_assert` to allow the farmer's async `on_disconnect` callback to remove the receiver before the test checks `plot_sync_receivers` length.
This commit is contained in:
@@ -516,9 +516,9 @@ async def test_harvester_restart(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
# Load all directories for both harvesters
|
||||
await add_and_validate_all_directories(env)
|
||||
# Stop the harvester and make sure the receiver gets dropped on the farmer and refreshing gets stopped
|
||||
# Stop the harvester and wait for the receiver to be dropped on the farmer (async via on_disconnect)
|
||||
await env.split_harvester_managers[0].exit()
|
||||
assert len(env.farmer.plot_sync_receivers) == 1
|
||||
await time_out_assert(5, lambda: len(env.farmer.plot_sync_receivers), 1)
|
||||
assert not env.harvesters[0].plot_manager._refreshing_enabled
|
||||
assert not env.harvesters[0].plot_manager.needs_refresh()
|
||||
# Start the harvester, wait for the handshake and make sure the receiver comes back
|
||||
|
||||
Reference in New Issue
Block a user