Skip to content

test(core): remove the integration-test directories when each test ends - #799

Merged
ajianaz merged 5 commits into
developfrom
test/testdir-core-integ
Nov 15, 2026
Merged

ajianaz merged 5 commits into
developfrom
test/testdir-core-integ

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

The tole-core integration tests (tests/*.rs, including the mcp sandbox tests and their support module) use TestDir (from #789) instead of leaking their directories. No production code changes.

Why

Refs #781: cora-e2-*, cora-e3-*, cora-e5-*, tole-gate-*, tole-sbx-life-*, tole-batch-*, tole-fuzz-*, tole-perf-*, tole-lock-* and the rest left a directory per test per run (the cora-* entries of the report).

Changes

  • 34 files under crates/tole-core/tests. Gate and hook marker files that were temp paths (tole-gate-count-* and friends) become files inside a guard; the gate hook helper returns its guard.
  • Process-wide fixtures that no per-test guard can own keep one fixed shared-* directory under cargo's target tmp instead of a new one per run: the mcp sandbox out_root (shared-sbx-root, its per-test subdirectories are recreated by name) and the command sandbox tree (shared-cmdsbx, emptied on init). Neither is tole-*.
  • The sandbox lifecycle workspaces are TestDirs held by the tests.
  • 34 files, 202 added and 209 removed lines.

Testing

  • cargo test --workspace with a private TMPDIR and the whole series applied: 2267 tests pass, 0 tole-*/cora-* entries in TMPDIR or target/tmp (only the fixed shared-* directories).
  • Before (baseline run on develop, entries matched by prefix): about 266 entries of these families.
  • cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and -p tole-core --no-default-features --tests: clean.

Refs #781

Refs #781. Adds TestDir (unique scratch directory removed on drop, also on panic, robust to read-only trees, TOLE_KEEP_TEST_DIRS=1 and keep() escape hatches) and ChildGuard (kill and reap a child before its directory goes) to tole-core and tole-cli, for integration tests and unit tests. No test is converted yet.
Refs #781. WorkDir creates <root>/w inside a TestDir, so work.with_extension("home") lands in the same removed root.
Refs #781. Process-wide fixtures that no per-test guard can own (the mcp sandbox out root, the command sandbox tree) keep one fixed shared-* directory under the target tmp dir instead of a new one per run.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 736adf1 into develop Nov 15, 2026
22 checks passed
@ajianaz
ajianaz deleted the test/testdir-core-integ branch November 20, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants