wait_until_i_am_the_last_task() - num_alive should be 0, not 1
This commit is contained in:
parent
78363d65ca
commit
87e09a60f7
2 changed files with 6 additions and 5 deletions
|
|
@ -23,6 +23,8 @@ use crate::{
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 64)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 64)]
|
||||||
async fn test_e2e_download() {
|
async fn test_e2e_download() {
|
||||||
|
wait_until_i_am_the_last_task().await.unwrap();
|
||||||
|
|
||||||
let timeout = std::env::var("E2E_TIMEOUT")
|
let timeout = std::env::var("E2E_TIMEOUT")
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|v| v.parse().ok())
|
.and_then(|v| v.parse().ok())
|
||||||
|
|
@ -38,7 +40,7 @@ async fn test_e2e_download() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Wait to ensure everything is dropped.
|
// Wait to ensure everything is dropped.
|
||||||
wait_until_i_am_the_last_task().await;
|
wait_until_i_am_the_last_task().await.unwrap();
|
||||||
|
|
||||||
drop_checks.check().unwrap();
|
drop_checks.check().unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,13 +196,13 @@ pub async fn wait_until(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn wait_until_i_am_the_last_task() {
|
pub async fn wait_until_i_am_the_last_task() -> anyhow::Result<()> {
|
||||||
let metrics = tokio::runtime::Handle::current().metrics();
|
let metrics = tokio::runtime::Handle::current().metrics();
|
||||||
wait_until(
|
wait_until(
|
||||||
|| {
|
|| {
|
||||||
let num_alive = metrics.num_alive_tasks();
|
let num_alive = metrics.num_alive_tasks();
|
||||||
if num_alive != 1 {
|
if num_alive != 0 {
|
||||||
bail!("metrics.num_alive_tasks() = {num_alive}, expected 1")
|
bail!("metrics.num_alive_tasks() = {num_alive}, expected 0")
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
@ -210,5 +210,4 @@ pub async fn wait_until_i_am_the_last_task() {
|
||||||
Duration::from_secs(6),
|
Duration::from_secs(6),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue