diff --git a/crates/provider/src/native.rs b/crates/provider/src/native.rs index 9ee2ce5ecdcbd42b0770e66b25b302476e6545a0..353bcac04a0ff209ac14d433fac8286e929e1133 100644 --- a/crates/provider/src/native.rs +++ b/crates/provider/src/native.rs @@ -601,7 +601,7 @@ fn create_process_with_log_tasks( #[cfg(test)] mod tests { - use std::{ffi::OsString, str::FromStr}; + use std::{ffi::OsString, str::FromStr, fs}; use procfs::process::Process; use support::fs::in_memory::{InMemoryFile, InMemoryFileSystem}; @@ -626,6 +626,23 @@ mod tests { ); } + #[tokio::test] + async fn provider_tmp_dir_method_should_set_the_temporary_for_provider() { + let fs = InMemoryFileSystem::new(HashMap::from([ + (OsString::from_str("/").unwrap(), InMemoryFile::dir()), + ( + OsString::from_str("/someotherdir").unwrap(), + InMemoryFile::dir(), + ), + ])); + let provider = NativeProvider::new(fs.clone()).tmp_dir("/someotherdir"); + + // we create a namespace to ensure tmp dir will be used to store namespace + let namespace = provider.create_namespace().await.unwrap(); + + assert!(namespace.base_dir().starts_with("/someotherdir")) + } + #[tokio::test] async fn provider_create_namespace_method_should_create_a_new_namespace_and_returns_it() { let fs = InMemoryFileSystem::new(HashMap::from([