diff --git a/tests/contest/contest/src/tests/process/mod.rs b/tests/contest/contest/src/tests/process/mod.rs index ce1911343..8237bcd5f 100644 --- a/tests/contest/contest/src/tests/process/mod.rs +++ b/tests/contest/contest/src/tests/process/mod.rs @@ -1,2 +1,2 @@ mod process_test; -pub use process_test::get_process_test; \ No newline at end of file +pub use process_test::get_process_test; diff --git a/tests/contest/contest/src/tests/process/process_test.rs b/tests/contest/contest/src/tests/process/process_test.rs index 75930319a..2e91b363e 100644 --- a/tests/contest/contest/src/tests/process/process_test.rs +++ b/tests/contest/contest/src/tests/process/process_test.rs @@ -1,8 +1,7 @@ use crate::utils::test_inside_container; -use anyhow::{Context, Ok, Result}; -use oci_spec::runtime::{ - ProcessBuilder, Spec, SpecBuilder, -}; +use anyhow::{bail, Context, Ok, Result}; +use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder}; +use std::fs; use test_framework::{test_result, Test, TestGroup, TestResult}; fn create_spec() -> Result { @@ -10,10 +9,7 @@ fn create_spec() -> Result { .process( ProcessBuilder::default() .cwd("/test") - .env(vec![ - "testa=valuea".into(), - "testb=123".into() - ]) + .env(vec!["testa=valuea".into(), "testb=123".into()]) .build() .expect("error in creating process config"), ) @@ -25,7 +21,15 @@ fn create_spec() -> Result { fn process_test() -> TestResult { let spec = test_result!(create_spec()); - test_inside_container(spec, &|_| Ok(())) + test_inside_container(spec, &|_| { + match fs::create_dir("/test") { + Result::Ok(_) => { /*This is expected*/ } + Err(e) => { + bail!(e) + } + } + Ok(()) + }) } pub fn get_process_test() -> TestGroup { diff --git a/tests/contest/runtimetest/src/tests.rs b/tests/contest/runtimetest/src/tests.rs index 8162773a0..52e57a5d0 100644 --- a/tests/contest/runtimetest/src/tests.rs +++ b/tests/contest/runtimetest/src/tests.rs @@ -608,4 +608,4 @@ pub fn validate_rootfs() { if entries != expected { eprintln!("error due to rootfs want {expected:?}, got {entries:?}"); } -} \ No newline at end of file +}