Skip to content

Commit 954560b

Browse files
committed
fix(tests): make worktree/sanity tests pass on ubuntu CI
Two independent, pre-existing test bugs surfaced on ubuntu-latest (macos passed) after a GitHub runner image change plus the find-based test order: 1. create_test_repo ran git init + git commit in a sandboxed empty $HOME without configuring user.name/user.email, relying on the runner's ambient git config. The current ubuntu image no longer provides one, so the commit aborted with 'fatal: empty ident name not allowed'. Set an explicit local git identity in the sandbox repo. 2. The runner sets the sandbox $HOME once and relies on each test file's cleanup to leave it existing for the next file. sanity's cleanup did 'rm -rf $HOME' without recreating it, unlike worktree's cleanup. find orders sanity before worktree on ubuntu, so worktree's setup 'touch $HOME/$fingerprint' silently failed and the teardown's assert_file_exists then failed, making the file exit non-zero even though all assertions passed. Add 'mkdir -p $HOME' to match worktree's cleanup convention. This was masked until bug #1 was fixed, because finish_tests exited before cleanup ran while tests were failing.
1 parent a2b2fd9 commit 954560b

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎tests/sanity.test.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ cleanup() {
2424
if [[ -f "$HOME/$fingerprint" ]]; then
2525
echo
2626
rm -rf "$HOME"
27+
mkdir -p "$HOME"
2728
fi
2829
}
2930

‎tests/worktree.test.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ create_test_repo() {
3131
mkdir -p "$repo_dir"
3232
cd "$repo_dir"
3333
git init -q
34+
git config user.email "test@example.com"
35+
git config user.name "Test"
3436
git commit -q --allow-empty -m "initial commit"
3537
}
3638

0 commit comments

Comments
 (0)