Skip to content

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

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

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

Conversation

@OzzyHelper

@OzzyHelper OzzyHelper commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cargo tests no longer read or write the real ~/.foc-devnet. A test-only home override, serialized by a process-wide lock shared with FOC_DEVNET_BASEDIR tests, redirects every test that touches foc-devnet state into a temp directory. Two tests that asserted nothing meaningful are fixed or removed.

Closes #240

Changes

  • Add paths::TestHome, a #[cfg(test)]-only override for foc_devnet_home() guarded by a process-wide lock. TestHome::lock_only() shares the lock with FOC_DEVNET_BASEDIR tests.
  • Use TestHome for keys, run-ID persistence, latest symlink, build status, and disk usage tests.
  • Rewrite the latest-symlink test to call the real create_latest_symlink and cover 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
  • test_print_uptime is unrelated and fails in this environment because no Docker CLI is available (pre-existing, documented).

Quality Report

Changes: 7 files changed, 99 insertions(+), 58 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 19, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Nov 19, 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