Add small random delay to async test for stress-testing
This commit is contained in:
parent
7c2c03aa40
commit
374e50ee6b
@ -97,6 +97,10 @@ async fn heavy_async() {
|
|||||||
for i in 0..100 {
|
for i in 0..100 {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
tasks.push(tokio::spawn(async move {
|
tasks.push(tokio::spawn(async move {
|
||||||
|
tokio::time::sleep(tokio::time::Duration::from_millis(
|
||||||
|
rand::random::<u64>() % 100,
|
||||||
|
))
|
||||||
|
.await;
|
||||||
let result = client.addition(i, i).await.unwrap();
|
let result = client.addition(i, i).await.unwrap();
|
||||||
assert_eq!(result, i + i);
|
assert_eq!(result, i + i);
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user