fix tests with tokio 1.8.1

This commit is contained in:
Ali MJ Al-Nasrawy 2021-07-10 00:01:03 +03:00
parent 2504c2ecb0
commit d69fa441b4
1 changed files with 16 additions and 2 deletions

View File

@ -350,7 +350,14 @@ mod tests {
assert_ne!(buf1, buf2);
drop(settings);
assert!(notify_on_drop::is_dropped());
// Ensure the task will drop eventually
let mut times = 0;
while !notify_on_drop::is_dropped() {
sleep(Duartion::from_millis(100)).await;
times += 1;
assert!(times < 10, "Timeout waiting for task drop");
}
}
#[actix_rt::test]
@ -372,7 +379,14 @@ mod tests {
assert!(!notify_on_drop::is_dropped());
drop(service);
assert!(notify_on_drop::is_dropped());
// Ensure the task will drop eventually
let mut times = 0;
while !notify_on_drop::is_dropped() {
sleep(Duartion::from_millis(100)).await;
times += 1;
assert!(times < 10, "Timeout waiting for task drop");
}
}
#[test]