mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-22 23:10:35 +00:00
tests: await bounded offer preparation
This commit is contained in:
1 parent
7dfe9c18bd
commit
b4c2e09ca6
1 file changed
+7
-6
@@ -2054,13 +2054,14 @@ mod tests {
|
||||
|
||||
task.send_offer_request();
|
||||
assert!(task.offer_preparation_rx.is_some());
|
||||
for _ in 0..100 {
|
||||
tokio::task::yield_now().await;
|
||||
task.send_offer_request();
|
||||
if task.state != SyncTaskState::Offering {
|
||||
break;
|
||||
tokio::time::timeout(Duration::from_secs(2), async {
|
||||
while task.state == SyncTaskState::Offering {
|
||||
tokio::time::sleep(Duration::from_millis(1)).await;
|
||||
task.send_offer_request();
|
||||
}
|
||||
}
|
||||
})
|
||||
.await
|
||||
.expect("bounded offer-preparation worker did not complete");
|
||||
|
||||
assert_eq!(task.state, SyncTaskState::Complete);
|
||||
assert!(rx.try_recv().is_err());
|
||||
|
||||
Reference in new issue
Block a user