Watch
0
0
Fork
You've already forked hyperhive
0

give each appservice test its own scratch directory

This commit is contained in:
atlas 2026-10-27 17:30:53 +01:00
commit f66b169158

View file

@ -447,15 +447,16 @@ mod tests {
const REGEX: &str = "^@[a-z0-9._=/-]+:t\\.local$";
/// A directory of its own per call. A counter, not the clock, keeps two
/// tests that start in the same clock tick out of one directory.
fn scratch() -> PathBuf {
static NEXT: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
let dir = std::env::temp_dir().join(format!(
"swarm-appservice-{}-{}",
std::process::id(),
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("after the epoch")
.as_nanos()
NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
));
std::fs::remove_dir_all(&dir).ok();
std::fs::create_dir_all(&dir).expect("temp dir");
dir
}