forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: verify
systemd-sysuser
service will be triggered with new
deployment See ostreedev/ostree#3069 (comment)
- Loading branch information
1 parent
15fc7d4
commit 305458d
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
## kola: | ||
## description: Verify systemd-sysuser will be triggered with new deployment. | ||
|
||
# See https://github.com/ostreedev/ostree/issues/3069#issuecomment-1798115799 | ||
|
||
set -xeuo pipefail | ||
|
||
. "$KOLA_EXT_DATA/commonlib.sh" | ||
|
||
username=footest | ||
|
||
case "${AUTOPKGTEST_REBOOT_MARK:-}" in | ||
"") | ||
ok "first boot" | ||
if getent passwd ${username}; then | ||
fatal "should not get user ${username} before testing" | ||
fi | ||
# create sysusers config | ||
mkdir /etc/sysusers.d | ||
echo "u ${username} - ${username}" > /etc/sysusers.d/30-${username}.conf | ||
/tmp/autopkgtest-reboot second-boot | ||
;; | ||
|
||
second-boot) | ||
# reboot to check user footest not created | ||
# Because the update trigger condition is /usr/'s modification time should be | ||
# newer than /etc/.updated & /var/.updated files, but /usr/'s modification time | ||
# is always the same as the .updated files according to | ||
# https://ostreedev.github.io/ostree/repo/#content-objects | ||
ok "second boot" | ||
if getent passwd ${username}; then | ||
fatal "should not get user ${username} after second boot" | ||
fi | ||
# create a new deployment | ||
ref=$(rpm-ostree status --json | jq -r '.deployments[0].origin') | ||
ostree admin deploy --karg-append=somedummykarg=1 $ref | ||
/tmp/autopkgtest-reboot third-boot | ||
;; | ||
|
||
third-boot) | ||
ok "third boot" | ||
# Fixed by https://github.com/ostreedev/ostree/pull/1631, we always | ||
# remove .updated files from new deployments so the condition will trigger. | ||
# check user footest created | ||
if ! getent passwd ${username}; then | ||
fatal "should get user ${username} with new deployment after third boot" | ||
fi | ||
;; | ||
*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";; | ||
esac |