diff --git a/pueue/tests/client/integration/follow.rs b/pueue/tests/client/integration/follow.rs index 64f3fc44..aef1cda9 100644 --- a/pueue/tests/client/integration/follow.rs +++ b/pueue/tests/client/integration/follow.rs @@ -2,7 +2,6 @@ use anyhow::{Context, Result}; use rstest::rstest; use crate::client::helper::*; -use pueue_lib::network::message::ResetMessage; pub fn set_read_local_logs(daemon: &mut PueueDaemon, read_local_logs: bool) -> Result<()> { // Force the client to read remote logs via config file. @@ -102,44 +101,48 @@ async fn fail_on_non_existing(#[case] read_local_logs: bool) -> Result<()> { Ok(()) } -/// This test is ignored on apple, since it's super flaky. Somebody has to debug this. -#[cfg(not(target = "x86_64-apple-darwin"))] -mod non_apple { - use super::*; - - /// Fail and print an error message when following a non-existing task disappears - #[rstest] - #[case(true)] - #[case(false)] - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] - async fn fail_on_disappearing(#[case] read_local_logs: bool) -> Result<()> { - let mut daemon = daemon().await?; - set_read_local_logs(&mut daemon, read_local_logs)?; - let shared = &daemon.settings.shared; - - // Add a task echoes something and waits for a while - assert_success(add_task(shared, "echo test && sleep 20").await?); - wait_for_task_condition(shared, 0, |task| task.is_running()).await?; - - // Reset the daemon after 2 seconds. At this point, the client will already be following the - // output and should notice that the task went away.. - // This is a bit hacky, but our client test helper always waits for the command to finish - // and I'm feeling too lazy to add a new helper function now. - let moved_shared = shared.clone(); - tokio::task::spawn(async move { - sleep_ms(2000).await; - // Reset the daemon - send_message(&moved_shared, ResetMessage {}) - .await - .expect("Failed to send Start tasks message"); - }); - - // Execute `follow` and remove the task - // The client should exit with exit code `1`. - let output = run_client_command(shared, &["follow", "0"])?; - - assert_snapshot_matches_stdout("follow__fail_on_disappearing", output.stdout)?; - - Ok(()) - } -} +// /// This test is commented for the time being. +// /// There's a race condition that can happen from time to time. +// /// It's especially reliably hit on MacOS for some reason. +// /// +// /// What happens is that the daemon resets in between reading the output of the file +// /// and the check whether the task actually still exists in the daemon. +// /// There's really no way to properly work around this. +// /// So I'll keep this commented for the time being. +// /// +// /// +// /// Fail and print an error message when following a non-existing task disappears +// #[rstest] +// #[case(true)] +// #[case(false)] +// #[tokio::test(flavor = "multi_thread", worker_threads = 2)] +// async fn fail_on_disappearing(#[case] read_local_logs: bool) -> Result<()> { +// let mut daemon = daemon().await?; +// set_read_local_logs(&mut daemon, read_local_logs)?; +// let shared = &daemon.settings.shared; +// +// // Add a task echoes something and waits for a while +// assert_success(add_task(shared, "echo test && sleep 20").await?); +// wait_for_task_condition(shared, 0, |task| task.is_running()).await?; +// +// // Reset the daemon after 2 seconds. At this point, the client will already be following the +// // output and should notice that the task went away.. +// // This is a bit hacky, but our client test helper always waits for the command to finish +// // and I'm feeling too lazy to add a new helper function now. +// let moved_shared = shared.clone(); +// tokio::task::spawn(async move { +// sleep_ms(2000).await; +// // Reset the daemon +// send_message(&moved_shared, ResetMessage {}) +// .await +// .expect("Failed to send Start tasks message"); +// }); +// +// // Execute `follow` and remove the task +// // The client should exit with exit code `1`. +// let output = run_client_command(shared, &["follow", "0"])?; +// +// assert_snapshot_matches_stdout("follow__fail_on_disappearing", output.stdout)?; +// +// Ok(()) +// }