Skip to content

test: isolate filesystem tests from the real ~/.foc-devnet - #249

Closed
OzzyHelper wants to merge 1 commit into
FilOzone:mainfrom
OzzyHelper:koan/implement-247
Closed

OzzyHelper wants to merge 1 commit into
FilOzone:mainfrom
OzzyHelper:koan/implement-247

Conversation

@OzzyHelper

@OzzyHelper OzzyHelper commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cargo tests no longer read or write the real ~/.foc-devnet. A test-only TestHome override redirects path resolution into a temp directory, serialized by a process-wide lock shared with FOC_DEVNET_BASEDIR tests.

Closes #247

Changes

  • Add paths::TestHome, a #[cfg(test)]-only override for foc_devnet_home() guarded by a process-wide lock; TestHome::lock_only() shares that lock with FOC_DEVNET_BASEDIR tests.
  • Use TestHome for keys/mnemonic, run-ID persistence, latest symlink, build status, and disk usage tests.
  • Rewrite the latest-symlink test to call the real create_latest_symlink, covering broken-link recreation and valid-link replacement.
  • Remove test_print_running_status, which only asserted is_ok() while shelling out to Docker.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --lib -- --skip test_print_uptime — 51 passed
  • Verified ~/.foc-devnet mtimes unchanged after the test run.
  • test_print_uptime was skipped because it needs a Docker CLI unavailable in this environment (pre-existing).

Quality Report

Changes: 7 files changed, 113 insertions(+), 59 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: 1 issue(s)

  • Branch is not pushed to remote

Add a test-only TestHome override to paths::foc_devnet_home(), serialized
by a process-wide lock shared with FOC_DEVNET_BASEDIR tests. Use it in all
tests that persist keys, mnemonics, run IDs, or the latest symlink.

Rewrite the latest-symlink test to call create_latest_symlink directly and
cover broken-link recreation plus valid-link replacement. Drop
test_print_running_status, which only asserted is_ok() while shelling out
to Docker.
@FilOzzy FilOzzy added this to FOC Nov 20, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Nov 20, 2026
@FilOzzy FilOzzy moved this from 📌 Triage to ⌨️ In Progress in FOC Nov 20, 2026
@Kubuxu Kubuxu closed this Nov 20, 2026
@github-project-automation github-project-automation Bot moved this from ⌨️ In Progress to 🎉 Done in FOC Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

2 participants