mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 01:56:37 +03:00
Avoid reusing stale CSP test fixtures
Retry an unused test directory on AlreadyExists without deleting or reading any pre-existing fixture contents. AI assistance: Codex, under maintainer direction.
This commit is contained in:
@@ -214,12 +214,18 @@ mod tests {
|
||||
|
||||
impl Fixture {
|
||||
fn new() -> Self {
|
||||
let root = std::env::temp_dir().join(format!(
|
||||
"impeccable-csp-761-{}-{}",
|
||||
std::process::id(), NEXT_FIXTURE.fetch_add(1, Ordering::Relaxed),
|
||||
));
|
||||
std::fs::create_dir(&root).unwrap();
|
||||
Self(root)
|
||||
loop {
|
||||
let root = std::env::temp_dir().join(format!(
|
||||
"impeccable-csp-761-{}-{}",
|
||||
std::process::id(), NEXT_FIXTURE.fetch_add(1, Ordering::Relaxed),
|
||||
));
|
||||
match std::fs::create_dir(&root) {
|
||||
Ok(()) => return Self(root),
|
||||
// Never reuse or remove files left by another run.
|
||||
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => continue,
|
||||
Err(e) => panic!("create CSP fixture: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn scan(&self, path: &str, body: &str) -> Value {
|
||||
|
||||
Reference in New Issue
Block a user