Skip to content
Snippets Groups Projects
Verified Commit e14c5781 authored by Loris Moulin's avatar Loris Moulin
Browse files

feat: added test for tmp_dir method on NativeProvider

parent 17618467
Branches
No related merge requests found
......@@ -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([
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment