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:
Zachary Brown
2026-04-10 11:32:34 -05:00
committed by GitHub
parent f393929129
commit 183b350d4e
+2 -2
View File
@@ -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