Skip to content

test: add comprehensive tests for cache module#7

Merged
raiderrobert merged 1 commit into
mainfrom
feat/cache-tests
Feb 12, 2026
Merged

test: add comprehensive tests for cache module#7
raiderrobert merged 1 commit into
mainfrom
feat/cache-tests

Conversation

@raiderrobert

Copy link
Copy Markdown
Owner

Summary

  • Add 17 new tests covering copy_dir_all, clear_cache, list_cached, and get_or_clone cache-hit paths
  • Fix existing env-dependent tests with a static Mutex to prevent flaky parallel execution
  • All tests use tempfile::TempDir for isolation and the DIECUT_CACHE_DIR env var override

Test plan

  • cargo fmt --check passes
  • cargo clippy -- -D warnings passes
  • cargo test passes (59 unit + 20 integration tests)

Cover copy_dir_all (flat, nested, symlink-skipping, empty dir),
clear_cache (full clear, URL-filtered, URL normalization, missing dir),
list_cached (metadata parsing, skip orphans, skip files, empty/missing),
and get_or_clone cache-hit paths (with/without ref, stale entry rejection).

Use a static Mutex to serialize tests that mutate the DIECUT_CACHE_DIR
env var, preventing flaky parallel execution.
@raiderrobert raiderrobert merged commit d0d26b3 into main Feb 12, 2026
5 checks passed
raiderrobert added a commit that referenced this pull request Feb 12, 2026
test: add comprehensive tests for cache module
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.

1 participant