Description
Current behavior 😯
In gix-worktree-state/tests/state/checkout.rs
, the test overwriting_files_and_lone_directories_works
fails occasionally on the assertion:
Usually it passes, but occasionally it fails. This happens both on CI and in manual runs. As far as I know, the failure only happens on macOS. Here's an example from CI in my fork:
FAIL [ 0.422s] gix-worktree-state-tests::worktree state::checkout::overwriting_files_and_lone_directories_works
--- STDOUT: gix-worktree-state-tests::worktree state::checkout::overwriting_files_and_lone_directories_works ---
running 1 test
test state::checkout::overwriting_files_and_lone_directories_works ... FAILED
failures:
failures:
state::checkout::overwriting_files_and_lone_directories_works
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.42s
--- STDERR: gix-worktree-state-tests::worktree state::checkout::overwriting_files_and_lone_directories_works ---
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
thread 'state::checkout::overwriting_files_and_lone_directories_works' panicked at gix-worktree-state/tests/state/checkout.rs:238:9:
assertion `left == right` failed
left: false
right: true
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I don't know why this happens, but maybe it is somehow related to concurrency? I say this based only on #1354 (comment), indicating that "the filesystem probe" for symlinks is "still not safe for concurrent operations."
Expected behavior 🤔
The test should pass in all runs, rather than just most.
Git behavior
I'm unsure if there is a corresponding Git behavior, because I am unsure if this is a test bug or a bug in the code under test. Above the line with the assertion, the test has this comment:
I'm not sure what aspect of Git behavior that's referring to, though. As far as I know, Git determines whether it will attempt to create symlinks on Windows by checking core.symlinks
and, unlike on other systems, defaults it to false
if it is not set in any scope.
Steps to reproduce 🕹
I don't know a good procedure. I've been running tests a fair amount and occasionally seeing the problem. Running the tests many times in succession would likely trigger it. Also running them many times in succession while only allowing one test to run at a time might shed some light on whether concurrency is involved, but this would of course be even more time-consuming.