Skip to content

Commit eeea9ae

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 008217c commit eeea9ae

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

t/t9210-scalar.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
104104
test_cmp_config -C test/src true core.fsmonitor
105105
'
106106

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+
107114
test_expect_success 'scalar unregister' '
108115
git init vanish/src &&
109116
scalar register vanish/src &&

t/t9211-scalar-clone.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,10 @@ test_expect_success 'progress without tty' '
174174
cleanup_clone $enlistment
175175
'
176176

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+
177183
test_done

0 commit comments

Comments
 (0)