Skip to content

Commit 1ffc014

Browse files
committed
chore(tests): make some tests less flaky
When I run these locally, they may now take more than 100ms to run, when being run in parallel. Increase the timeout duration to 1s.
1 parent 9491757 commit 1ffc014

File tree

1 file changed

+13
-4
lines changed
  • crates/matrix-sdk/src/client

1 file changed

+13
-4
lines changed

crates/matrix-sdk/src/client/mod.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,7 +3033,6 @@ pub(crate) mod tests {
30333033

30343034
use super::Client;
30353035
use crate::{
3036-
assert_let_timeout,
30373036
client::{futures::SendMediaUploadRequest, WeakClient},
30383037
config::{RequestConfig, SyncSettings},
30393038
futures::SendRequest,
@@ -3963,7 +3962,12 @@ pub(crate) mod tests {
39633962

39643963
// Call the endpoint once to check the timeout.
39653964
let mut stream = Box::pin(client.sync_stream(SyncSettings::new()).await);
3966-
assert_let_timeout!(Some(Ok(_)) = stream.next());
3965+
3966+
timeout(Duration::from_secs(1), async {
3967+
stream.next().await.unwrap().unwrap();
3968+
})
3969+
.await
3970+
.unwrap();
39673971
}
39683972

39693973
#[async_test]
@@ -3992,7 +3996,12 @@ pub(crate) mod tests {
39923996
let mut stream = Box::pin(
39933997
client.sync_stream(SyncSettings::new().ignore_timeout_on_first_sync(true)).await,
39943998
);
3995-
assert_let_timeout!(Some(Ok(_)) = stream.next());
3996-
assert_let_timeout!(Some(Ok(_)) = stream.next());
3999+
4000+
timeout(Duration::from_secs(1), async {
4001+
stream.next().await.unwrap().unwrap();
4002+
stream.next().await.unwrap().unwrap();
4003+
})
4004+
.await
4005+
.unwrap();
39974006
}
39984007
}

0 commit comments

Comments
 (0)