give each appservice test its own scratch directory
This commit is contained in:
parent
d5c5862654
commit
f66b169158
1 changed files with 5 additions and 4 deletions
|
|
@ -447,15 +447,16 @@ mod tests {
|
||||||
|
|
||||||
const REGEX: &str = "^@[a-z0-9._=/-]+:t\\.local$";
|
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 {
|
fn scratch() -> PathBuf {
|
||||||
|
static NEXT: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
|
||||||
let dir = std::env::temp_dir().join(format!(
|
let dir = std::env::temp_dir().join(format!(
|
||||||
"swarm-appservice-{}-{}",
|
"swarm-appservice-{}-{}",
|
||||||
std::process::id(),
|
std::process::id(),
|
||||||
std::time::SystemTime::now()
|
NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
|
||||||
.expect("after the epoch")
|
|
||||||
.as_nanos()
|
|
||||||
));
|
));
|
||||||
|
std::fs::remove_dir_all(&dir).ok();
|
||||||
std::fs::create_dir_all(&dir).expect("temp dir");
|
std::fs::create_dir_all(&dir).expect("temp dir");
|
||||||
dir
|
dir
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue