From b347c3817937f21ce25d46fd6ddb96ff81afcf8f Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 5 Feb 2025 01:48:14 +0100 Subject: [PATCH] test: extend systemd.unit.create stage test Extend the manifest for the systemd.unit.create stage to create one of each type of systemd unit currently supported. --- test/data/stages/systemd.unit.create/a.json | 21 +++++++++ .../stages/systemd.unit.create/a.mpp.yaml | 13 ++++++ test/data/stages/systemd.unit.create/b.json | 43 +++++++++++++++++++ .../stages/systemd.unit.create/b.mpp.yaml | 28 ++++++++++++ .../data/stages/systemd.unit.create/diff.json | 18 ++++++++ 5 files changed, 123 insertions(+) diff --git a/test/data/stages/systemd.unit.create/a.json b/test/data/stages/systemd.unit.create/a.json index a917a0ae..69976377 100644 --- a/test/data/stages/systemd.unit.create/a.json +++ b/test/data/stages/systemd.unit.create/a.json @@ -672,6 +672,27 @@ "filename": "/etc/systemd/user/create-directory.service", "size": "0" } + }, + { + "type": "org.osbuild.truncate", + "options": { + "filename": "/usr/lib/systemd/system/dev-disk-by-uuid-4f581be3-e8c2-4b44-9456-54df3ab92944.swap", + "size": "0" + } + }, + { + "type": "org.osbuild.truncate", + "options": { + "filename": "/usr/lib/systemd/system/service.socket", + "size": "0" + } + }, + { + "type": "org.osbuild.truncate", + "options": { + "filename": "/usr/lib/systemd/system/data.mount", + "size": "0" + } } ] } diff --git a/test/data/stages/systemd.unit.create/a.mpp.yaml b/test/data/stages/systemd.unit.create/a.mpp.yaml index 381cf897..8b773366 100644 --- a/test/data/stages/systemd.unit.create/a.mpp.yaml +++ b/test/data/stages/systemd.unit.create/a.mpp.yaml @@ -29,7 +29,20 @@ pipelines: mpp-eval: gpgkeys exclude: docs: true + - type: org.osbuild.truncate options: filename: "/etc/systemd/user/create-directory.service" size: '0' + - type: org.osbuild.truncate + options: + filename: "/usr/lib/systemd/system/dev-disk-by-uuid-4f581be3-e8c2-4b44-9456-54df3ab92944.swap" + size: '0' + - type: org.osbuild.truncate + options: + filename: "/usr/lib/systemd/system/service.socket" + size: '0' + - type: org.osbuild.truncate + options: + filename: "/usr/lib/systemd/system/data.mount" + size: '0' diff --git a/test/data/stages/systemd.unit.create/b.json b/test/data/stages/systemd.unit.create/b.json index 63a96b83..cc9f36b0 100644 --- a/test/data/stages/systemd.unit.create/b.json +++ b/test/data/stages/systemd.unit.create/b.json @@ -710,6 +710,49 @@ } } } + }, + { + "type": "org.osbuild.systemd.unit.create", + "options": { + "filename": "data.mount", + "config": { + "Unit": { + "DefaultDependencies": true + }, + "Mount": { + "What": "/dev/sdb1", + "Where": "/data" + } + } + } + }, + { + "type": "org.osbuild.systemd.unit.create", + "options": { + "filename": "service.socket", + "config": { + "Unit": { + "DefaultDependencies": true + }, + "Socket": { + "ListenStream": "/run/service/api.socket" + } + } + } + }, + { + "type": "org.osbuild.systemd.unit.create", + "options": { + "filename": "dev-disk-by-uuid-4f581be3-e8c2-4b44-9456-54df3ab92944.swap", + "config": { + "Unit": { + "DefaultDependencies": true + }, + "Swap": { + "What": "/dev/disk/by-uuid/4f581be3-e8c2-4b44-9456-54df3ab92944" + } + } + } } ] } diff --git a/test/data/stages/systemd.unit.create/b.mpp.yaml b/test/data/stages/systemd.unit.create/b.mpp.yaml index 6ff459d3..5aa896f8 100644 --- a/test/data/stages/systemd.unit.create/b.mpp.yaml +++ b/test/data/stages/systemd.unit.create/b.mpp.yaml @@ -59,3 +59,31 @@ pipelines: - local-fs.target RequiredBy: - multi-user.target + + - type: org.osbuild.systemd.unit.create + options: + filename: data.mount + config: + Unit: + DefaultDependencies: true + Mount: + What: "/dev/sdb1" + Where: "/data" + + - type: org.osbuild.systemd.unit.create + options: + filename: service.socket + config: + Unit: + DefaultDependencies: true + Socket: + ListenStream: "/run/service/api.socket" + + - type: org.osbuild.systemd.unit.create + options: + filename: "dev-disk-by\x2duuid-4f581be3\x2de8c2\x2d4b44\x2d9456\x2d54df3ab92944.swap" + config: + Unit: + DefaultDependencies: true + Swap: + What: "/dev/disk/by-uuid/4f581be3-e8c2-4b44-9456-54df3ab92944" diff --git a/test/data/stages/systemd.unit.create/diff.json b/test/data/stages/systemd.unit.create/diff.json index 425aeb34..dd936245 100644 --- a/test/data/stages/systemd.unit.create/diff.json +++ b/test/data/stages/systemd.unit.create/diff.json @@ -14,6 +14,24 @@ "sha256:69aa663d58cc063ea2d7659ac06354335c26e69e8fdb0036f952b082a70b5642" ] }, + "/usr/lib/systemd/system/dev-disk-by-uuid-4f581be3-e8c2-4b44-9456-54df3ab92944.swap": { + "content": [ + "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha256:4bb9e774438a2857a3845936c551b945f2ed6edabec3f9955d8e7d6b794a5a59" + ] + }, + "/usr/lib/systemd/system/service.socket": { + "content": [ + "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha256:2c029a69c7a57f920c99a3537c8db87b26825436e131a87106e25a69197d7eb6" + ] + }, + "/usr/lib/systemd/system/data.mount": { + "content": [ + "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha256:2f7e14d9785faa8e9b31188473cb5f87a7bc2a37b31b4c0c533f0e3bfd9d427d" + ] + }, "/usr/lib/sysimage/rpm/rpmdb.sqlite": { "content": [ null,