From fff5e2b43d291c789f534815127f8422b2716f76 Mon Sep 17 00:00:00 2001 From: sat0ken <15720506+sat0ken@users.noreply.github.com> Date: Thu, 14 Nov 2024 04:26:58 +0900 Subject: [PATCH] fix err to append env value to default Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com> --- .../contest/src/tests/process/process_test.rs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/contest/contest/src/tests/process/process_test.rs b/tests/contest/contest/src/tests/process/process_test.rs index 8595cfef3..8143cf430 100644 --- a/tests/contest/contest/src/tests/process/process_test.rs +++ b/tests/contest/contest/src/tests/process/process_test.rs @@ -8,18 +8,21 @@ use test_framework::{test_result, Test, TestGroup, TestResult}; use crate::utils::test_inside_container; fn create_spec() -> Result { - let mut spec = SpecBuilder::default() - .process( - ProcessBuilder::default() - .args(vec!["runtimetest".to_string(), "process".to_string()]) - .cwd("/test") - .build() - .expect("error in creating process config"), - ) + let mut process = ProcessBuilder::default() + .args(vec!["runtimetest".to_string(), "process".to_string()]) + .cwd("/test") + .build() + .expect("error in creating process config"); + let mut env = process.env().clone().unwrap(); + env.push("testa=valuea".to_string()); + env.push("testb=123".to_string()); + process.set_env(Some(env)); + + let spec = SpecBuilder::default() + .process(process) .build() .context("failed to build spec")?; - spec.process() - .set_env(vec!["testa=valuea".into(), "testb=123".into()]); + Ok(spec) }