From 59d4d073551209a00a21782f8f1bb9ce202333de Mon Sep 17 00:00:00 2001 From: Pjotr Date: Fri, 6 Nov 2026 13:36:09 +0000 Subject: streaming: stop two tests sharing (and deleting) one temp dir mark_failed_appends_failure_marker_with_the_error and create_run_log_rejects_a_reused_id both worked in /tmp/gn4-streaming-test-, and the second removes the directory when it is done, so under cargo's parallel test threads it could delete the first one's log mid-assertion -- an intermittent failure that has nothing to do with either test's subject. Give each its own directory. --- src/streaming.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/streaming.rs b/src/streaming.rs index e9804a8..67aa670 100644 --- a/src/streaming.rs +++ b/src/streaming.rs @@ -226,7 +226,11 @@ mod tests { #[test] fn mark_failed_appends_failure_marker_with_the_error() { - let dir = std::env::temp_dir().join(format!("gn4-streaming-test-{}", std::process::id())); + // Each test gets its own directory: these run in parallel, and + // the reused-id test below removes its directory when it is done, + // which used to delete this one's log mid-assertion. + let dir = std::env::temp_dir() + .join(format!("gn4-streaming-fail-marker-{}", std::process::id())); std::fs::create_dir_all(&dir).unwrap(); let log = create_run_log(dir.to_str().unwrap(), Some("fail-marker-test")).unwrap(); mark_failed(&log, &"Rscript died with status 1".to_string()); @@ -264,7 +268,7 @@ mod tests { #[test] fn create_run_log_rejects_a_reused_id() { let cache_dir = - std::env::temp_dir().join(format!("gn4-streaming-test-{}", std::process::id())); + std::env::temp_dir().join(format!("gn4-streaming-dup-id-{}", std::process::id())); let cache_dir = cache_dir.to_str().unwrap(); std::fs::create_dir_all(cache_dir).unwrap(); let id = "dup-run"; -- cgit 1.4.1