1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-10 01:26:14 +02:00

use tempfile for testcase

This commit is contained in:
yukang 2021-10-02 12:32:50 +08:00
parent 2d0c6b0202
commit 26e345d190
3 changed files with 5 additions and 1 deletions

1
Cargo.lock generated
View File

@ -1546,4 +1546,5 @@ dependencies = [
"serial_test",
"systemd",
"tabwriter",
"tempfile",
]

View File

@ -61,6 +61,7 @@ oci-spec = { git = "https://github.com/containers/oci-spec-rs", rev = "5018f8e5
quickcheck = "1"
serial_test = "0.5.1"
ipc-channel = "0.15.0"
tempfile = "3"
[profile.release]
lto = true

View File

@ -117,7 +117,9 @@ mod tests {
fn test_spec_json() -> Result<()> {
let mut spec = Default::default();
spec = set_for_rootless(&spec)?;
to_writer_pretty(&File::create("config.json")?, &spec)?;
let tmpdir = tempfile::tempdir().unwrap();
let path = tmpdir.path().join("config.json");
to_writer_pretty(&File::create(path)?, &spec)?;
Ok(())
}
}