Skip to content

test: share script writer and GitConfig defaults - #86

Merged
rolandjitsu merged 2 commits into
rolandjitsu:mainfrom
profiling:profiling/share-test-script-helper
Nov 24, 2026
Merged

rolandjitsu merged 2 commits into
rolandjitsu:mainfrom
profiling:profiling/share-test-script-helper

Conversation

@profiling

@profiling profiling commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two test-only refactors that remove copy-paste across the test code. No production changes.

  1. Fake script writer. src/git.rs and src/evict.rs each had their own copy of the helper that writes a fake git script through a short-lived sh (the ETXTBSY fix from test(git): write fake git scripts without a held descriptor #81). It now lives in a crate-private src/test_util.rs, so a future fix applies to both. The integration tests under tests/ are separate crates and cannot see this module; they use tests/helpers.rs (test: write fake git scripts without a held fd #85).
  2. GitConfig defaults. 26 test sites spelled out every GitConfig field, so adding refresh touched all of them. Tests now build from one default per side (tests/helpers.rs::test_git_config, src/test_util.rs::test_git_config) and override only what they need with struct update syntax. Net -148 lines.

The commits are independent and can be reviewed one by one.

Verification

  • cargo fmt --check, cargo clippy -D warnings and cargo test --all-features pass.
  • Lib test binary in a loop: 4 parallel loops x 100 runs, 0 failures (script writer commit).
  • Merge with test: write fake git scripts without a held fd #85 is clean (checked with git merge-tree).

Generated with Claude Code

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.72%. Comparing base (d3ea9bb) to head (0d514eb).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
- Coverage   98.72%   98.72%   -0.01%     
==========================================
  Files           9       10       +1     
  Lines        6451     6427      -24     
==========================================
- Hits         6369     6345      -24     
  Misses         82       82              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@profiling profiling changed the title test: share the fake script writer in src tests test: share script writer and GitConfig defaults Nov 23, 2026
@profiling
profiling force-pushed the profiling/share-test-script-helper branch from ba99993 to bf1df51 Compare November 23, 2026 08:12
@profiling
profiling marked this pull request as draft November 23, 2026 08:13
@profiling
profiling force-pushed the profiling/share-test-script-helper branch from bf1df51 to feb6119 Compare November 23, 2026 08:16
git.rs and evict.rs each carried their own copy of the sh-based script
writer. Move it to a crate-private test module so a fix applies to both.

Assisted-by: Claude:claude-sonnet-5-5
@profiling
profiling force-pushed the profiling/share-test-script-helper branch from feb6119 to 8aff1bc Compare November 23, 2026 08:17
26 test sites spelled out every GitConfig field, so adding refresh
touched all of them. Build from one default per side (tests/helpers.rs,
src/test_util.rs) and override only what a test needs.

Assisted-by: Claude:claude-sonnet-5-5
@profiling
profiling force-pushed the profiling/share-test-script-helper branch from 8aff1bc to 0d514eb Compare November 24, 2026 01:26
@profiling
profiling marked this pull request as ready for review November 24, 2026 01:28
@rolandjitsu
rolandjitsu merged commit 93bb604 into rolandjitsu:main Nov 24, 2026
13 checks passed
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