test(collab): wait for retired worker slot
This commit is contained in:
parent
c766338fef
commit
abfebfea87
|
|
@ -114,6 +114,20 @@ impl DesktopCollabRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(in crate::collab_runtime) fn wait_for_worker_slot_for_test(&mut self) {
|
||||
// Tests that inject a replacement transport must cross the same
|
||||
// retirement acknowledgement gate as launch_pending_network.
|
||||
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(2);
|
||||
while self.require_worker_slot().is_err() {
|
||||
assert!(
|
||||
std::time::Instant::now() < deadline,
|
||||
"retired collaboration worker must release its slot"
|
||||
);
|
||||
std::thread::yield_now();
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::collab_runtime) fn retire_workers(&mut self) {
|
||||
// A generation identifies one worker incarnation, not the retained
|
||||
// guest session actor. Fence it before requesting shutdown so neither
|
||||
|
|
|
|||
|
|
@ -615,6 +615,8 @@ fn retry_against_new_epoch_ends_without_replaying_pending_edit() {
|
|||
},
|
||||
&mut host,
|
||||
);
|
||||
runtime.wait_for_worker_slot_for_test();
|
||||
assert!(runtime.network.is_none());
|
||||
let (network, retry_commands) = guest_command_channel_with_capacity_for_test(8);
|
||||
runtime.network = Some(network);
|
||||
let retry_connection = connection(3);
|
||||
|
|
|
|||
Loading…
Reference in a new issue