diff --git a/pueue/tests/client/integration/follow.rs b/pueue/tests/client/integration/follow.rs index 90bc06a5..64f3fc44 100644 --- a/pueue/tests/client/integration/follow.rs +++ b/pueue/tests/client/integration/follow.rs @@ -102,39 +102,44 @@ async fn fail_on_non_existing(#[case] read_local_logs: bool) -> Result<()> { Ok(()) } -/// Fail and print an error message when following a non-existing task disappears +/// This test is ignored on apple, since it's super flaky. Somebody has to debug this. #[cfg(not(target = "x86_64-apple-darwin"))] -#[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(()) +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(()) + } }