t921*: test scalar behavior starting maintenance
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>
Derrick Stolee committed
Jan 27, 2023 at 20:06 UTC
eeea9ae1657e32ee16f8452ff201b2ca54d51641
2 files changed
+13
t/t9210-scalar.sh
+7
@@ -104,6 +104,13 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
104
test_cmp_config -C test/src true core.fsmonitor
105
'
106
107
+test_expect_success 'scalar register fails when background maintenance fails' '
108
+ git init register-repo &&
109
+ GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
110
+ test_must_fail scalar register register-repo 2>err &&
111
+ grep "could not turn on maintenance" err
112
+'
113
+
114
test_expect_success 'scalar unregister' '
115
git init vanish/src &&
116
scalar register vanish/src &&
t/t9211-scalar-clone.sh
+6
@@ -174,4 +174,10 @@ test_expect_success 'progress without tty' '
174
cleanup_clone $enlistment
175
'
176
177
+test_expect_success 'scalar clone fails when background maintenance fails' '
178
+ GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
179
+ test_must_fail scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
180
+ grep "could not turn on maintenance" err
181
+'
182
+
183
test_done