diff options
| author | tv <tv@krebsco.de> | 2026-11-18 11:14:56 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 12:23:19 +0100 |
| commit | ecfed5d7e344c617f582d1d91c7395a210a70192 (patch) | |
| tree | b3bd6e23037220d641aa7ffb500dfa60b12ef2a7 /src/api/dashboard/mod.rs | |
| parent | b6a2649f54741e88a886fe8f64e916415e8a4b72 (diff) | |
files: a test's scratch directory goes when the test ends
`scratch_dir` gives a guard (`Scratch`) that removes the directory with
all it holds when dropped, the test passing or failing. Each test keeps
it for as long as it uses the directory; the dashboard's browser check
writes its page into one.
Diffstat (limited to 'src/api/dashboard/mod.rs')
| -rw-r--r-- | src/api/dashboard/mod.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index 15b8cf9..c0de169 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -913,8 +913,8 @@ mod tests { #[test] #[ignore] fn dashboard_in_a_browser() { - let file = - std::env::temp_dir().join(format!("continuum-dashboard-{}.html", std::process::id())); + let dir = crate::files::scratch_dir("dashboard"); + let file = dir.join("page.html"); std::fs::write(&file, &page().1).expect("page written"); let check = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/api/dashboard/check.js"); @@ -928,7 +928,6 @@ mod tests { PATH, with Playwright's library and its Chromium (check.nix)" ) }); - let _ = std::fs::remove_file(&file); assert!(status.success(), "the browser checks failed"); } |
