From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
Miguel Rincon Barahona <mrincon@gitlab.com>,
Kev Kloss <kkloss@gitlab.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] t7900: fix host-dependent behaviour when testing git-maintenance(1)
Date: Mon, 25 Nov 2024 06:33:41 +0100 [thread overview]
Message-ID: <eb504a75147d8609be66e131d239a69d192d693d.1732511129.git.ps@pks.im> (raw)
In-Reply-To: <20241122153033.GA1737136@coredump.intra.peff.net>
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 <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Oh, true, thanks for reporting. This here should fix it.
Patrick
t/t7900-maintenance.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 6d6ffaaf37..4bbc171958 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -1012,10 +1012,15 @@ test_expect_success 'repacking loose objects is quiet' '
'
test_expect_success 'maintenance aborts with existing lock file' '
- test_when_finished "rm -rf repo" &&
+ test_when_finished "rm -rf repo script" &&
+ mkdir script &&
+ write_script script/systemctl <<-\EOF &&
+ true
+ EOF
+
git init repo &&
: >repo/.git/objects/schedule.lock &&
- test_must_fail git -C repo maintenance start 2>err &&
+ test_must_fail env PATH="$PWD/script:$PATH" git -C repo maintenance start --scheduler=systemd 2>err &&
test_grep "Another scheduled git-maintenance(1) process seems to be running" err
'
base-commit: 2f2daa412d02135a1f1f00da3f424217467f8d16
--
2.47.0.274.g962d0b743d.dirty
next prev parent reply other threads:[~2024-11-25 5:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 10:48 [PATCH] builtin/gc: provide hint when maintenance hits a stale schedule lock Patrick Steinhardt
2024-11-19 17:17 ` Justin Tobler
2024-11-22 15:30 ` Jeff King
2024-11-25 5:33 ` Patrick Steinhardt [this message]
2024-11-25 11:52 ` [PATCH] t7900: fix host-dependent behaviour when testing git-maintenance(1) Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb504a75147d8609be66e131d239a69d192d693d.1732511129.git.ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kkloss@gitlab.com \
--cc=mrincon@gitlab.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox