Skip to content

test: write fake git scripts without a held fd - #85

Merged
rolandjitsu merged 1 commit into
rolandjitsu:mainfrom
profiling:profiling/fix-e2e-script-etxtbsy
Nov 24, 2026
Merged

rolandjitsu merged 1 commit into
rolandjitsu:mainfrom
profiling:profiling/fix-e2e-script-etxtbsy

Conversation

@profiling

@profiling profiling commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the same flaky Text file busy (ETXTBSY) failure as #81, in the integration tests.

tests/e2e.rs, tests/lifecycle.rs and tests/retry.rs write a fake git
script with std::fs::write and then exec it. Tests run on parallel threads of
one process: a child forked by another test while the writable descriptor is
open inherits it, so the later exec fails with ETXTBSY.

helpers::write_test_script writes the script through a short-lived sh, so this
process never holds a writable descriptor for it. Six call sites use it (four in
e2e.rs, one each in lifecycle.rs and retry.rs).

Verification

The compiled e2e test binary run in a loop, debug build, default test threads.

Run Before (main) After
e2e, one loop 4/200 failed 0/200
e2e, 4 loops in parallel 22/600 failed 0/600

All 26 failures before the change were Text file busy, in
upload_pack_cap_holds_a_slot_until_the_process_exits and
want_by_sha_tolerates_object_check_failure. lifecycle (4 loops x 100) and
retry (4 loops x 8) also pass with 0 failures after the change; I did not
measure them before it.

cargo fmt --check, cargo clippy -D warnings and cargo test --all-features
pass.

Not in this PR

Under the same stress client_disconnect_kills_upload_pack_process_group fails
rarely (about 1 in 800 runs of that test, also on main) at its process_alive
assertion. It is unrelated to script writing and is left for a separate change.

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.73%. Comparing base (46b88dc) to head (d924911).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #85   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files           9        9           
  Lines        6466     6466           
=======================================
  Hits         6384     6384           
  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.

@rolandjitsu

Copy link
Copy Markdown
Owner

Needs a rebase, then it should be good to go.

Writing a script in-process leaves a writable fd that a child forked by
a parallel test inherits, so the later exec fails with "Text file busy".
Write it through a short-lived sh instead, as the unit tests already do.

Assisted-by: Claude:claude-sonnet-5-5
@profiling
profiling force-pushed the profiling/fix-e2e-script-etxtbsy branch from cbfbe82 to d924911 Compare November 24, 2026 01:49
@rolandjitsu
rolandjitsu merged commit ddb61ca into rolandjitsu:main Nov 24, 2026
12 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