test: add simple fstab credential test

This commit is contained in:
Lennart Poettering 2023-06-29 21:52:57 +02:00
parent 3a065dfc29
commit 51235f2fe6
2 changed files with 5 additions and 0 deletions

View file

@ -15,6 +15,7 @@ QEMU_CREDS=(
"-smbios type=11,value=io.systemd.credential.binary:binarysmbioscredential=bWFnaWNiaW5hcnlkYXRh"
"-smbios type=11,value=io.systemd.credential.binary:sysusers.extra=dSBjcmVkdGVzdHVzZXIK"
"-smbios type=11,value=io.systemd.credential.binary:tmpfiles.extra=ZiAvdG1wL3NvdXJjZWRmcm9tY3JlZGVudGlhbCAtIC0gLSAtIHRtcGZpbGVzc2VjcmV0Cg=="
"-smbios type=11,value=io.systemd.credential.binary:fstab.extra=aW5qZWN0ZWQgL2luamVjdGVkIHRtcGZzIFgtbW91bnQubWtkaXIgMCAwCg=="
)
QEMU_OPTIONS="${QEMU_OPTIONS:-} ${QEMU_CREDS[*]}"

View file

@ -304,6 +304,10 @@ systemd-run -p DynamicUser=yes -p 'LoadCredential=os:/etc/os-release' \
if ! systemd-detect-virt -q -c ; then
# Validate that the credential we inserted via the initrd logic arrived
test "$(systemd-creds cat --system myinitrdcred)" = "guatemala"
# Check that the fstab credential logic worked
test -d /injected
grep -q /injected /proc/self/mountinfo
fi
systemd-analyze log-level info