From e0dced887f1b9af295db495ea482f49540127ea8 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 17 Mar 2026 09:36:07 +0100 Subject: [PATCH] fix(test): resolve test_data_dir from CI PVC layout (ohlcv/ES.FUT) CI PVC structure is /data/test-data/ohlcv/ES.FUT, local is test_data/ES.FUT. test_data_dir() now searches both layouts and checks both FOXHUNT_TEST_DATA and TEST_DATA_DIR env vars. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/trainers/dqn/smoke_tests/helpers.rs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) 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 }