mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-26 07:30:11 +00:00
fix(tests): replace hardcoded /tmp paths with tempdir + add 300 unit tests (#659)
* test: add unit tests across 20 modules for coverage push Add 300+ unit tests covering config, context, evaluation, extensions, LLM, secrets, tools/builder, and tools/mcp modules. All tests are pure unit tests (no mocks) exercising serde roundtrips, edge cases, error paths, and business logic. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(tests): replace hardcoded /tmp paths with tempfile::tempdir The e2e_metrics_test::test_metrics_collected_from_tool_trace test was failing because setup_test_dir() created /tmp/ironclaw_metrics_test but the fixture referenced /tmp/ironclaw_e2e_test/hello.txt (path mismatch). Added LlmTrace::replace_paths() to substitute fixture paths at runtime, then converted all 12 test files from hardcoded /tmp/ironclaw_* paths to tempfile::tempdir(). Tests are now isolated, parallel-safe, and leave no debris on disk. Regression test: test_metrics_collected_from_tool_trace now passes consistently regardless of prior /tmp state. Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8fbb782090
commit
cf96a3253c
+4
-2
@@ -3258,8 +3258,10 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_discover_wasm_channels_nonexistent_dir() {
|
||||
let channels =
|
||||
discover_wasm_channels(std::path::Path::new("/tmp/ironclaw_nonexistent_dir")).await;
|
||||
let channels = discover_wasm_channels(
|
||||
&std::env::temp_dir().join("ironclaw_nonexistent_dir_abcxyz123"),
|
||||
)
|
||||
.await;
|
||||
assert!(channels.is_empty());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user