diff --git a/crates/ml/src/trainers/dqn/smoke_tests/helpers.rs b/crates/ml/src/trainers/dqn/smoke_tests/helpers.rs index 5cb39cb11..4777ce960 100644 --- a/crates/ml/src/trainers/dqn/smoke_tests/helpers.rs +++ b/crates/ml/src/trainers/dqn/smoke_tests/helpers.rs @@ -94,21 +94,33 @@ pub(super) fn assert_finite_f32(val: f32, name: &str) { /// `test_data/ES.FUT` relative to the workspace root. /// Returns `None` if the directory doesn't exist. pub(super) fn test_data_dir() -> Option { - if let Ok(dir) = std::env::var("FOXHUNT_TEST_DATA") { - if std::path::Path::new(&dir).exists() { - return Some(dir); + // Check env vars: FOXHUNT_TEST_DATA (explicit), TEST_DATA_DIR (CI PVC root) + for var in &["FOXHUNT_TEST_DATA", "TEST_DATA_DIR"] { + if let Ok(dir) = std::env::var(var) { + let path = std::path::Path::new(&dir); + // Search for ES.FUT in common layouts: + // 1. $DIR/ES.FUT (direct) + // 2. $DIR/ohlcv/ES.FUT (CI PVC layout) + for sub in &["ES.FUT", "ohlcv/ES.FUT"] { + let candidate = path.join(sub); + if candidate.exists() { + return Some(candidate.to_string_lossy().into_owned()); + } + } } } - // Auto-detect: workspace_root/test_data/ES.FUT (single symbol, no cross-symbol mixing) + // Auto-detect from workspace root: test_data/ES.FUT or test_data/ohlcv/ES.FUT let manifest = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_default(); let workspace = std::path::Path::new(&manifest) .parent() // crates/ .and_then(|p| p.parent()) // repo root .unwrap_or(std::path::Path::new("../..")); - let es_dir = workspace.join("test_data").join("ES.FUT"); - if es_dir.exists() { - Some(es_dir.to_string_lossy().into_owned()) - } else { - None + let test_data = workspace.join("test_data"); + for sub in &["ES.FUT", "ohlcv/ES.FUT"] { + let candidate = test_data.join(sub); + if candidate.exists() { + return Some(candidate.to_string_lossy().into_owned()); + } } + None }