Skip to content

Commit 1b6cb76

Browse files
committed
test: Remove flaky integration follow test
1 parent c3a52a5 commit 1b6cb76

File tree

1 file changed

+45
-42
lines changed

1 file changed

+45
-42
lines changed

pueue/tests/client/integration/follow.rs

+45-42
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use anyhow::{Context, Result};
22
use rstest::rstest;
33

44
use crate::client::helper::*;
5-
use pueue_lib::network::message::ResetMessage;
65

76
pub fn set_read_local_logs(daemon: &mut PueueDaemon, read_local_logs: bool) -> Result<()> {
87
// 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<()> {
102101
Ok(())
103102
}
104103

105-
/// This test is ignored on apple, since it's super flaky. Somebody has to debug this.
106-
#[cfg(not(target = "x86_64-apple-darwin"))]
107-
mod non_apple {
108-
use super::*;
109-
110-
/// Fail and print an error message when following a non-existing task disappears
111-
#[rstest]
112-
#[case(true)]
113-
#[case(false)]
114-
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
115-
async fn fail_on_disappearing(#[case] read_local_logs: bool) -> Result<()> {
116-
let mut daemon = daemon().await?;
117-
set_read_local_logs(&mut daemon, read_local_logs)?;
118-
let shared = &daemon.settings.shared;
119-
120-
// Add a task echoes something and waits for a while
121-
assert_success(add_task(shared, "echo test && sleep 20").await?);
122-
wait_for_task_condition(shared, 0, |task| task.is_running()).await?;
123-
124-
// Reset the daemon after 2 seconds. At this point, the client will already be following the
125-
// output and should notice that the task went away..
126-
// This is a bit hacky, but our client test helper always waits for the command to finish
127-
// and I'm feeling too lazy to add a new helper function now.
128-
let moved_shared = shared.clone();
129-
tokio::task::spawn(async move {
130-
sleep_ms(2000).await;
131-
// Reset the daemon
132-
send_message(&moved_shared, ResetMessage {})
133-
.await
134-
.expect("Failed to send Start tasks message");
135-
});
136-
137-
// Execute `follow` and remove the task
138-
// The client should exit with exit code `1`.
139-
let output = run_client_command(shared, &["follow", "0"])?;
140-
141-
assert_snapshot_matches_stdout("follow__fail_on_disappearing", output.stdout)?;
142-
143-
Ok(())
144-
}
145-
}
104+
// /// This test is commented for the time being.
105+
// /// There's a race condition that can happen from time to time.
106+
// /// It's especially reliably hit on MacOS for some reason.
107+
// ///
108+
// /// What happens is that the daemon resets in between reading the output of the file
109+
// /// and the check whether the task actually still exists in the daemon.
110+
// /// There's really no way to properly work around this.
111+
// /// So I'll keep this commented for the time being.
112+
// ///
113+
// ///
114+
// /// Fail and print an error message when following a non-existing task disappears
115+
// #[rstest]
116+
// #[case(true)]
117+
// #[case(false)]
118+
// #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
119+
// async fn fail_on_disappearing(#[case] read_local_logs: bool) -> Result<()> {
120+
// let mut daemon = daemon().await?;
121+
// set_read_local_logs(&mut daemon, read_local_logs)?;
122+
// let shared = &daemon.settings.shared;
123+
//
124+
// // Add a task echoes something and waits for a while
125+
// assert_success(add_task(shared, "echo test && sleep 20").await?);
126+
// wait_for_task_condition(shared, 0, |task| task.is_running()).await?;
127+
//
128+
// // Reset the daemon after 2 seconds. At this point, the client will already be following the
129+
// // output and should notice that the task went away..
130+
// // This is a bit hacky, but our client test helper always waits for the command to finish
131+
// // and I'm feeling too lazy to add a new helper function now.
132+
// let moved_shared = shared.clone();
133+
// tokio::task::spawn(async move {
134+
// sleep_ms(2000).await;
135+
// // Reset the daemon
136+
// send_message(&moved_shared, ResetMessage {})
137+
// .await
138+
// .expect("Failed to send Start tasks message");
139+
// });
140+
//
141+
// // Execute `follow` and remove the task
142+
// // The client should exit with exit code `1`.
143+
// let output = run_client_command(shared, &["follow", "0"])?;
144+
//
145+
// assert_snapshot_matches_stdout("follow__fail_on_disappearing", output.stdout)?;
146+
//
147+
// Ok(())
148+
// }

0 commit comments

Comments
 (0)