Re: [RFC PATCH 3/5] maintenance: use packaged systemd units
- From
Max Gautier <mg@max.gautier.name>
- Date
- Mar 19, 2024, 12:09 UTC
- Message-ID
- <ZfmAfIErHRZVbd49@framework>
- In-Reply-To
- <20240318153257.27451-4-mg@max.gautier.name>
I'm working on updating the test in t7900-maintenance.sh, but I might be missing something here:
Show 9 quoted lines
>test_expect_success 'start and stop Linux/systemd maintenance' ' > write_script print-args <<-\EOF && > printf "%s\n" "$*" >>args > EOF > > XDG_CONFIG_HOME="$PWD" && > export XDG_CONFIG_HOME && > rm -f args && > GIT_TEST_MAINT_SCHEDULER="systemctl:./print-args" git maintenance start --scheduler=systemd-timer &&
Do I understand correctly that this means we're not actually running systemctl here, just printing the arguments to our file ?
Show 30 quoted lines
> # start registers the repo > git config --get --global --fixed-value maintenance.repo "$(pwd)" && > > for schedule in hourly daily weekly > do > test_path_is_file "systemd/user/git-maintenance@$schedule.timer" || return 1 > done && > test_path_is_file "systemd/user/git-maintenance@.service" && > > test_systemd_analyze_verify "systemd/user/git-maintenance@hourly.service" && > test_systemd_analyze_verify "systemd/user/git-maintenance@daily.service" && > test_systemd_analyze_verify "systemd/user/git-maintenance@weekly.service" && > > printf -- "--user enable --now git-maintenance@%s.timer\n" hourly daily weekly >expect && > test_cmp expect args && > > rm -f args && > GIT_TEST_MAINT_SCHEDULER="systemctl:./print-args" git maintenance stop && > > # stop does not unregister the repo > git config --get --global --fixed-value maintenance.repo "$(pwd)" && > > for schedule in hourly daily weekly > do > test_path_is_missing "systemd/user/git-maintenance@$schedule.timer" || return 1 > done && > test_path_is_missing "systemd/user/git-maintenance@.service" && > > printf -- "--user disable --now git-maintenance@%s.timer\n" hourly daily weekly >expect && > test_cmp expect args
The rest of the systemd tests only check that the service file are in XDG_CONFIG_HOME, which should not be the case anymore.
However, the test does not actually check we have enabled and started the timers as it is , right ?
Should I add that ? I'm not sure how, because it does not seem like the tests run in a isolated env, so it would mess with the systemd user manager of the developper running the tests...
Regarding systemd-analyze verify, do the tests have access to the source directory in a special way, or is using '../..' enough ?
Thanks
-- Max Gautier