diff --git a/swarm-authelia-bridge/src/store.rs b/swarm-authelia-bridge/src/store.rs index 474eb99f..046b3546 100644 --- a/swarm-authelia-bridge/src/store.rs +++ b/swarm-authelia-bridge/src/store.rs @@ -793,14 +793,13 @@ some_future_top_level_key: 7 /// one test's lifetime, not durable state (see `state-not-tmp`: this /// is exactly the legitimate use, not a place we persist anything). fn tempdir() -> std::path::PathBuf { + static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); let dir = std::env::temp_dir().join(format!( "swarm-authelia-bridge-test-{}-{}", std::process::id(), - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_nanos() + NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed) )); + fs::remove_dir_all(&dir).ok(); fs::create_dir_all(&dir).unwrap(); dir }