Skip to content

Commit ba874d1

Browse files
pks-tgitster
authored andcommitted
t7900: fix host-dependent behaviour when testing git-maintenance(1)
We have recently added a new test to t7900 that exercises whether git-maintenance(1) fails as expected when the "schedule.lock" file exists. The test depends on whether or not the host has the required executables present to schedule maintenance tasks in the first place, like systemd or launchctl -- if not, the test fails with an unrelated error before even checking for the lock file. This fails for example in our CI systems, where macOS images do not have launchctl available. Fix this issue by creating a stub systemctl(1) binary and using the systemd scheduler. Reported-by: Jeff King <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 656ca92 commit ba874d1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/t7900-maintenance.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,15 @@ test_expect_success 'repacking loose objects is quiet' '
996996
'
997997

998998
test_expect_success 'maintenance aborts with existing lock file' '
999-
test_when_finished "rm -rf repo" &&
999+
test_when_finished "rm -rf repo script" &&
1000+
mkdir script &&
1001+
write_script script/systemctl <<-\EOF &&
1002+
true
1003+
EOF
1004+
10001005
git init repo &&
10011006
: >repo/.git/objects/schedule.lock &&
1002-
test_must_fail git -C repo maintenance start 2>err &&
1007+
test_must_fail env PATH="$PWD/script:$PATH" git -C repo maintenance start --scheduler=systemd 2>err &&
10031008
test_grep "Another scheduled git-maintenance(1) process seems to be running" err
10041009
'
10051010

0 commit comments

Comments
 (0)