diff --git a/src/config/test_case.rs b/src/config/test_case.rs index ed779c9..6a6c33b 100644 --- a/src/config/test_case.rs +++ b/src/config/test_case.rs @@ -2,6 +2,8 @@ use std::{env, path::PathBuf, time::Duration}; use tempfile::TempDir; +use crate::utils::generate_test_id; + #[derive(Clone, Default)] pub struct TestCaseEnv { pub test: Vec<(&'static str, &'static str)>, @@ -57,10 +59,12 @@ pub struct TestCaseConfig { // Or an absolute path. // Defaults to resources/genesis/bitcoin-regtest pub genesis_dir: Option, + pub test_id: String, } impl Default for TestCaseConfig { fn default() -> Self { + let test_id = generate_test_id(); TestCaseConfig { n_nodes: 1, with_sequencer: true, @@ -68,16 +72,19 @@ impl Default for TestCaseConfig { with_light_client_prover: false, with_full_node: false, timeout: Duration::from_secs(60), - dir: std::env::var("TEST_OUT_DIR").map_or_else( - |_| { - TempDir::new() - .expect("Failed to create temporary directory") - .into_path() - }, - PathBuf::from, - ), + dir: std::env::var("TEST_OUT_DIR") + .map_or_else( + |_| { + TempDir::new() + .expect("Failed to create temporary directory") + .into_path() + }, + PathBuf::from, + ) + .join(test_id.clone()), docker: TestCaseDockerConfig::default(), genesis_dir: None, + test_id, } } }