]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t921*: test scalar behavior starting maintenance
authorDerrick Stolee <derrickstolee@github.com>
Fri, 27 Jan 2023 20:06:02 +0000 (20:06 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Jan 2023 20:38:26 +0000 (12:38 -0800)
A user recently reported issues with 'scalar register' and 'scalar
clone' in that they failed when the system had permissions locked down
so both 'crontab' and 'systemctl' commands failed when trying to enable
background maintenance.

This hard error is undesirable, but let's create tests that demonstrate
this behavior before modiying the behavior. We can use
GIT_TEST_MAINT_SCHEDULER to guarantee failure and check the exit code
and error message.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9210-scalar.sh
t/t9211-scalar-clone.sh

index 25f500cf682a33787e0809bf5e7b513fd9282e4c..13a4f6dbcf437c03d28d5be36b1945bd962e0fba 100755 (executable)
@@ -104,6 +104,13 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
        test_cmp_config -C test/src true core.fsmonitor
 '
 
+test_expect_success 'scalar register fails when background maintenance fails' '
+       git init register-repo &&
+       GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
+               test_must_fail scalar register register-repo 2>err &&
+       grep "could not turn on maintenance" err
+'
+
 test_expect_success 'scalar unregister' '
        git init vanish/src &&
        scalar register vanish/src &&
index 02d32fb6ede046fd1438d79299fbf8572f123b7f..a6156da29acaf1314f235f26d64c18942057e62e 100755 (executable)
@@ -174,4 +174,10 @@ test_expect_success 'progress without tty' '
        cleanup_clone $enlistment
 '
 
+test_expect_success 'scalar clone fails when background maintenance fails' '
+       GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
+               test_must_fail scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
+       grep "could not turn on maintenance" err
+'
+
 test_done