test: Enable TEST-54-CREDS on mkosi

This commit is contained in:
Daan De Meyer
2024-05-14 22:14:27 +02:00
parent 76fe0035df
commit 9e262ef92e
8 changed files with 61 additions and 3 deletions

View File

@@ -0,0 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Unit]
Description=populate initrd credential dir for TEST-54-CREDS
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=sh -c "mkdir -m 0755 -p /run/credentials && mkdir -m 0700 /run/credentials/@initrd && umask 0077 && echo guatemala > /run/credentials/@initrd/myinitrdcred"

View File

@@ -6,6 +6,9 @@ Dependencies=
minimal-0
minimal-1
InitrdInclude=
initrd/
[Output]
@Format=directory
RepartDirectories=mkosi.repart

View File

@@ -3,6 +3,29 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'enabled' : false,
'cmdline' : integration_test_template['cmdline'] + [
'systemd.set_credential=kernelcmdlinecred:uff',
'systemd.set_credential=sysctl.extra:kernel.domainname=sysctltest',
'systemd.set_credential=login.motd:hello',
'systemd.set_credential=login.issue:welcome',
'systemd.set_credential_binary=waldi:d29vb29mZmZ3dWZmZnd1ZmYK',
'rd.systemd.import_credentials=no',
'rd.systemd.wants=initrdcred.service',
],
'credentials' : integration_test_template['credentials'] + [
'mynspawncredential=strangevalue',
files('systemd.extra-unit.my-service.service'),
files('systemd.unit-dropin.my-service.service'),
files('systemd.unit-dropin.my-service.service~30-named.service'),
],
'qemu-args' : integration_test_template['qemu-args'] + [
'-fw_cfg', 'name=opt/io.systemd.credentials/myqemucredential,string=othervalue',
'-smbios', 'type=11,value=io.systemd.credential:smbioscredential=magicdata',
'-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==',
'-smbios', 'type=11,value=io.systemd.credential:getty.ttys.container=idontexist',
],
},
]

View File

@@ -0,0 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
Type=oneshot
ExecStart=touch /tmp/unit-cred

View File

@@ -0,0 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
ExecStart=touch /tmp/unit-dropin

View File

@@ -0,0 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
ExecStart=touch /tmp/unit-named-dropin

View File

@@ -3,8 +3,8 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'mkosi-args' : integration_test_template['mkosi-args'] + [
'--credential=@0@'.format(meson.current_source_dir() / 'systemd.unit-dropin.init.scope')
'credentials' : integration_test_template['credentials'] + [
files('systemd.unit-dropin.init.scope'),
]
},
]

View File

@@ -290,6 +290,8 @@ integration_test_template = {
'after' : '',
},
'cmdline' : [],
'credentials' : [],
'qemu-args' : [],
}
testdata_subdirs = [
'auxv',
@@ -410,6 +412,14 @@ foreach integration_test : integration_tests
]
endif
foreach credential : integration_test['credentials']
integration_test_args += ['--credential', credential]
endforeach
if integration_test['qemu-args'].length() > 0
integration_test_args += ['--qemu-args=@0@'.format(' '.join(integration_test['qemu-args']))]
endif
integration_test_args += integration_test['mkosi-args']
integration_test_env = {}