fix(#707): init test temp_dir combines AtomicU64 counter+nanos to prevent same-process parallel test collisions

This commit is contained in:
YeonGyu-Kim
2026-05-26 00:36:07 +09:00
parent dedad14ae4
commit 401f6b152c
2 changed files with 8 additions and 1 deletions

View File

@@ -381,11 +381,16 @@ mod tests {
use std::time::{SystemTime, UNIX_EPOCH};
fn temp_dir() -> std::path::PathBuf {
use std::sync::atomic::{AtomicU64, Ordering};
static COUNTER: AtomicU64 = AtomicU64::new(0);
let id = COUNTER.fetch_add(1, Ordering::Relaxed);
let nanos = SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("time should be after epoch")
.as_nanos();
std::env::temp_dir().join(format!("rusty-claude-init-{nanos}"))
// Combine counter + nanoseconds so parallel tests in the same process
// never collide even if two calls land in the same nanosecond (#707).
std::env::temp_dir().join(format!("rusty-claude-init-{nanos}-{id}"))
}
#[test]