diff --git a/Cargo.lock b/Cargo.lock index 57ce94a2..ce779671 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1433,6 +1433,7 @@ dependencies = [ "serde_json", "structopt", "tar", + "tempfile", "thiserror", "tokio 0.2.16", "url", diff --git a/http/Cargo.toml b/http/Cargo.toml index 9646dbce..95e23c94 100644 --- a/http/Cargo.toml +++ b/http/Cargo.toml @@ -38,3 +38,4 @@ bytes = "0.5.4" [dev-dependencies] hex = "0.4.2" hex-literal = "0.2.1" +tempfile = "3.1.0" diff --git a/http/src/v0/root_files.rs b/http/src/v0/root_files.rs index 73316bec..74e0e608 100644 --- a/http/src/v0/root_files.rs +++ b/http/src/v0/root_files.rs @@ -268,8 +268,8 @@ mod tests { let size = header.size()?; // writing to file is the only supported way to get the contents - let mut temp_file = std::env::temp_dir(); - temp_file.push("temporary_file_for_testing.txt"); + let tempdir = tempfile::tempdir()?; + let temp_file = tempdir.path().join("temporary_file_for_testing.txt"); entry.unpack(&temp_file)?; let bytes = std::fs::read(&temp_file);