Repository: osbuild/osbuild
Pull request #1873 (2024-09-01 05:30:09)

Update snapshots to 20240901
Results of the snapshot jobs:
Job(s) succeeded: 198
Job(s) failed: 1

If these are false, rebuild the enumerate cache manually:
Enumerate cache job succeeded: true
Check snapshot succeeded: true

Workflow run: https://github.com/osbuild/rpmrepo/actions/runs/10650002566



Patch:
diff --git a/Schutzfile b/Schutzfile
index 028dfbd0..6b629a2e 100644
--- a/Schutzfile
+++ b/Schutzfile
@@ -19,7 +19,7 @@
           {
             "title": "fedora-updates",
             "name": "fedora-updates",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-x86_64-updates-released-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-x86_64-updates-released-20240901"
           }
         ],
         "aarch64": [
@@ -31,7 +31,7 @@
           {
             "title": "fedora-updates",
             "name": "fedora-updates",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-aarch64-updates-released-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f39/f39-aarch64-updates-released-20240901"
           }
         ]
       }
@@ -50,7 +50,7 @@
           {
             "title": "fedora-updates",
             "name": "fedora-updates",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f40/f40-x86_64-updates-released-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f40/f40-x86_64-updates-released-20240901"
           }
         ],
         "aarch64": [
@@ -62,7 +62,7 @@
           {
             "title": "fedora-updates",
             "name": "fedora-updates",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f40/f40-aarch64-updates-released-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f40/f40-aarch64-updates-released-20240901"
           }
         ]
       }
@@ -76,14 +76,14 @@
           {
             "title": "fedora",
             "name": "fedora",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f41/f41-x86_64-rawhide-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f41/f41-x86_64-rawhide-20240901"
           }
         ],
         "aarch64": [
           {
             "title": "fedora",
             "name": "fedora",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f41/f41-aarch64-rawhide-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f41/f41-aarch64-rawhide-20240901"
           }
         ]
       }
@@ -97,34 +97,34 @@
           {
             "title": "baseos",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-baseos-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-baseos-20240901"
           },
           {
             "title": "appstream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-appstream-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-appstream-20240901"
           },
           {
             "title": "crb",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-crb-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-x86_64-crb-20240901"
           }
         ],
         "aarch64": [
           {
             "title": "baseos",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-baseos-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-baseos-20240901"
           },
           {
             "title": "appstream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-appstream-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-appstream-20240901"
           },
           {
             "title": "crb",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-crb-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el9/cs9-aarch64-crb-20240901"
           }
         ]
       }
@@ -138,34 +138,34 @@
           {
             "title": "baseos",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-baseos-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-baseos-20240901"
           },
           {
             "title": "appstream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-appstream-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-appstream-20240901"
           },
           {
             "title": "crb",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-crb-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-x86_64-crb-20240901"
           }
         ],
         "aarch64": [
           {
             "title": "baseos",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-baseos-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-baseos-20240901"
           },
           {
             "title": "appstream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-appstream-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-appstream-20240901"
           },
           {
             "title": "crb",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-crb-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/el10/cs10-aarch64-crb-20240901"
           }
         ]
       }
@@ -179,34 +179,34 @@
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-BaseOS",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-baseos-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-baseos-n9.5-20240901"
           },
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-AppStream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-appstream-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-appstream-n9.5-20240901"
           },
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-CRB",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-crb-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-x86_64-crb-n9.5-20240901"
           }
         ],
         "aarch64": [
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-BaseOS",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-baseos-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-baseos-n9.5-20240901"
           },
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-AppStream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-appstream-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-appstream-n9.5-20240901"
           },
           {
             "title": "RHEL-9-RPMREPO-NIGHTLY-CRB",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-crb-n9.5-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el9/el9-aarch64-crb-n9.5-20240901"
           }
         ]
       }
@@ -220,34 +220,34 @@
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-BaseOS",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-baseos-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-baseos-n10.0-20240901"
           },
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-AppStream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-appstream-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-appstream-n10.0-20240901"
           },
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-CRB",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-crb-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-x86_64-crb-n10.0-20240901"
           }
         ],
         "aarch64": [
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-BaseOS",
             "name": "baseos",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-baseos-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-baseos-n10.0-20240901"
           },
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-AppStream",
             "name": "appstream",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-appstream-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-appstream-n10.0-20240901"
           },
           {
             "title": "RHEL-10-RPMREPO-NIGHTLY-CRB",
             "name": "crb",
-            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-crb-n10.0-20240819"
+            "baseurl": "https://rpmrepo.osbuild.org/v2/mirror/rhvpn/el10/el10-aarch64-crb-n10.0-20240901"
           }
         ]
       }
diff --git a/stages/org.osbuild.bootc.install-to-filesystem.meta.json b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
index f2367b52..02268b27 100644
--- a/stages/org.osbuild.bootc.install-to-filesystem.meta.json
+++ b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
@@ -1,9 +1,9 @@
 {
   "summary": "Run bootc install to-filesystem",
   "description": [
-    "Note that this needs the disk.img in the inputs as one continous",
+    "Note that this needs the disk.img in the inputs as one continuous",
     "devices so that bootupd can install grub to the mbr. It also needs",
-    "all relevant mount points for booting (e.g. /boot, /boot/efi) in",
+    "all relevant mount points for booting (e.g. `/boot`, `/boot/efi`) in",
     "mounted in the \"mounts\" path.",
     "Buildhost commands used: bootc"
   ],
diff --git a/stages/org.osbuild.bootc.install.config.meta.json b/stages/org.osbuild.bootc.install.config.meta.json
index a5f7e379..37fe6123 100644
--- a/stages/org.osbuild.bootc.install.config.meta.json
+++ b/stages/org.osbuild.bootc.install.config.meta.json
@@ -3,7 +3,7 @@
   "description": [
     "The bootc install process supports some basic customization. This",
     "configuration file is in TOML format, and will be discovered by the",
-    "installation process in via drop-in files in /usr/lib/bootc/install that",
+    "installation process via drop-in files in `/usr/lib/bootc/install` that",
     "are processed in alphanumerical order.",
     "The individual files are merged into a single final installation config, so",
     "it is supported for e.g. a container base image to provide a default root",
diff --git a/stages/org.osbuild.bootupd.gen-metadata.meta.json b/stages/org.osbuild.bootupd.gen-metadata.meta.json
index bfc4e4fc..41d52910 100644
--- a/stages/org.osbuild.bootupd.gen-metadata.meta.json
+++ b/stages/org.osbuild.bootupd.gen-metadata.meta.json
@@ -1,5 +1,5 @@
 {
-  "summary": "Transforms /usr/lib/ostree-boot into a bootupd-compatible update payload.",
+  "summary": "Transforms `/usr/lib/ostree-boot` into a bootupd-compatible update payload.",
   "description": [
     "Scrapes metadata (e.g. RPM versions) about shim/grub and puts them along with their component files in",
     "`/usr/lib/bootupd/updates/`.",
diff --git a/stages/org.osbuild.chrony.meta.json b/stages/org.osbuild.chrony.meta.json
index f52cd479..caf72909 100644
--- a/stages/org.osbuild.chrony.meta.json
+++ b/stages/org.osbuild.chrony.meta.json
@@ -19,11 +19,11 @@
     "  - 'maxpoll'",
     "  - 'iburst' (defaults to true)",
     "  - 'prefer' (defaults to false)",
-    "The 'leapsectz' option configures chrony behavior related to automatic checking",
+    "The `leapsectz` option configures chrony behavior related to automatic checking",
     "of the next occurrence of the leap second, using the provided timezone. Its",
     "value is a string representing a timezone from the system tz database (e.g.",
     "'right/UTC'). If an empty string is provided, then all occurrences of",
-    "'leapsectz' directive are removed from the configuration.",
+    "`leapsectz` directive are removed from the configuration.",
     "Constraints:",
     "  - Exactly one of 'timeservers' or 'servers' options must be provided."
   ],
diff --git a/stages/org.osbuild.copy.meta.json b/stages/org.osbuild.copy.meta.json
index 439ec3ff..2fca6b87 100644
--- a/stages/org.osbuild.copy.meta.json
+++ b/stages/org.osbuild.copy.meta.json
@@ -3,7 +3,7 @@
   "description": [
     "Stage to copy items, that is files or trees, from inputs to mount",
     "points or the tree. Multiple items can be copied. The source and",
-    "destination is an url. Supported locations ('schemes') are `tree`,",
+    "destination is an URL. Supported locations ('schemes') are `tree`,",
     "`mount` and `input`.",
     "The path format follows the rsync convention that if the paths",
     "ends with a slash `/` the content of that directory is copied not",
diff --git a/stages/org.osbuild.coreos.platform.meta.json b/stages/org.osbuild.coreos.platform.meta.json
index b548ce05..3d23a3fc 100644
--- a/stages/org.osbuild.coreos.platform.meta.json
+++ b/stages/org.osbuild.coreos.platform.meta.json
@@ -15,7 +15,7 @@
     "   are primarily console settings.",
     "4. Apply any platform specific kernel arguments along with the",
     "   `ignition.platform.id={platform-name}` kernel argument.",
-    "5. Create the grub console.cfg file and apply any platform",
+    "5. Create the grub `console.cfg` file and apply any platform",
     "   specific grub console configuration.",
     "This stage is highly CoreOS specific and subject to change in the",
     "future if/when we change the way platform specific information is",
diff --git a/stages/org.osbuild.crypttab.meta.json b/stages/org.osbuild.crypttab.meta.json
index 0f2bb1a2..1c219170 100644
--- a/stages/org.osbuild.crypttab.meta.json
+++ b/stages/org.osbuild.crypttab.meta.json
@@ -1,5 +1,5 @@
 {
-  "summary": "Create /etc/crypttab entries for encrypted block devices",
+  "summary": "Create `/etc/crypttab` entries for encrypted block devices",
   "description": [
     "See crypttab(5) for a detailed description of the format but in brief:",
     "each item in the list of `volumes` describes an encrypted block device",
diff --git a/stages/org.osbuild.fdo.meta.json b/stages/org.osbuild.fdo.meta.json
index 9c61693b..e89c745e 100644
--- a/stages/org.osbuild.fdo.meta.json
+++ b/stages/org.osbuild.fdo.meta.json
@@ -3,7 +3,7 @@
   "description": [
     "FDO stage to write down the initial DIUN pub key root certificates",
     "to be read by the manufacturer client",
-    "This will create a '/fdo_diun_root_certs.pem' with content",
+    "This will create a `/fdo_diun_root_certs.pem` with content",
     "specified via the `rootcerts` input."
   ],
   "schema_2": {
diff --git a/stages/org.osbuild.fix-bls.meta.json b/stages/org.osbuild.fix-bls.meta.json
index 91a5579d..cdbb7ec8 100644
--- a/stages/org.osbuild.fix-bls.meta.json
+++ b/stages/org.osbuild.fix-bls.meta.json
@@ -1,16 +1,16 @@
 {
-  "summary": "Fix paths in /boot/loader/entries",
+  "summary": "Fix paths in `/boot/loader/entries`",
   "description": [
-    "Fixes paths in /boot/loader/entries that have incorrect paths for /boot.",
-    "This happens because some boot loader config tools (e.g. grub2-mkrelpath)",
-    "examine /proc/self/mountinfo to find the \"real\" path to /boot, and find the",
+    "Fixes paths in `/boot/loader/entries` that have incorrect paths for `/boot`.",
+    "This happens because some boot loader config tools (e.g. `grub2-mkrelpath`)",
+    "examine `/proc/self/mountinfo` to find the \"real\" path to `/boot`, and find the",
     "path to the osbuild tree - which won't be valid at boot time for this image.",
     "The paths in the Bootloader Specification are relative to the partition",
     "they are located on, i.e. `/boot/loader/...` if `/boot` is on the root",
     "file-system partition. If `/boot` is on a separate partition, the correct",
     "path would be `/loader/.../` The `prefix` can be used to adjust for that.",
     "By default it is `/boot`, i.e. assumes `/boot` is on the root file-system.",
-    "This stage reads and (re)writes all .conf files in /boot/loader/entries."
+    "This stage reads and (re)writes all `.conf` files in `/boot/loader/entries`."
   ],
   "schema": {
     "additionalProperties": false,
diff --git a/stages/org.osbuild.fstab.meta.json b/stages/org.osbuild.fstab.meta.json
index f2810a5b..fe0b6ba6 100644
--- a/stages/org.osbuild.fstab.meta.json
+++ b/stages/org.osbuild.fstab.meta.json
@@ -1,9 +1,9 @@
 {
-  "summary": "Create /etc/fstab entries for filesystems",
+  "summary": "Create `/etc/fstab` entries for filesystems",
   "description": [
     "Each filesystem item must have at least the fs_spec, i.e `uuid`,",
     "`label`, `partlabel` or `device` and a `path` (mount point).",
-    "This stage replaces /etc/fstab, removing any existing entries.",
+    "This stage replaces `/etc/fstab`, removing any existing entries.",
     "NB: The ostree configuration options are experimental and might",
     "be replaced with a different mechanism in the near future."
   ],
diff --git a/stages/org.osbuild.mkswap b/stages/org.osbuild.mkswap
new file mode 100755
index 00000000..3e2d192c
--- /dev/null
+++ b/stages/org.osbuild.mkswap
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+import subprocess
+import sys
+
+import osbuild.api
+
+
+def main(devices, options):
+    device = devices["device"]["path"]
+
+    uuid = options["uuid"]
+    label = options.get("label")
+    opts = []
+
+    if label:
+        opts = ["--label", label]
+
+    subprocess.run(["mkswap", "--uuid", uuid] + opts + [device],
+                   encoding='utf8', check=True)
+
+
+if __name__ == '__main__':
+    args = osbuild.api.arguments()
+    ret = main(args["devices"], args["options"])
+    sys.exit(ret)
diff --git a/stages/org.osbuild.mkswap.meta.json b/stages/org.osbuild.mkswap.meta.json
new file mode 100644
index 00000000..63aecc1f
--- /dev/null
+++ b/stages/org.osbuild.mkswap.meta.json
@@ -0,0 +1,40 @@
+{
+  "summary": "Construct a swap area via mkswap(8)",
+  "description": [
+    "Construct a swap area with the given options at the device",
+    "specified via `device`.",
+    "Buildhost commands used: `mkswap`."
+  ],
+  "schema_2": {
+    "devices": {
+      "type": "object",
+      "additionalProperties": true,
+      "required": [
+        "device"
+      ],
+      "properties": {
+        "device": {
+          "type": "object",
+          "additionalProperties": true
+        }
+      }
+    },
+    "options": {
+      "additionalProperties": false,
+      "required": [
+        "uuid"
+      ],
+      "properties": {
+        "uuid": {
+          "description": "UUID for the file system",
+          "type": "string"
+        },
+        "label": {
+          "description": "Label for the file system",
+          "type": "string",
+          "maxLength": 12
+        }
+      }
+    }
+  }
+}


Test patch:
diff --git a/stages/test/test_mkswap.py b/stages/test/test_mkswap.py
new file mode 100644
index 00000000..d729f80a
--- /dev/null
+++ b/stages/test/test_mkswap.py
@@ -0,0 +1,105 @@
+#!/usr/bin/python3
+
+import os.path
+import subprocess
+import uuid
+from unittest import mock
+
+import pytest
+
+from osbuild import testutil
+from osbuild.testutil import has_executable
+
+STAGE_NAME = "org.osbuild.mkswap"
+
+
+# Prepare dataset containing good and bad API call parameters
+@pytest.mark.parametrize("test_data, expected_err", [
+    # Bad API parameters
+    ({}, "'uuid' is a required property"),
+    ({"uuid": 123}, "123 is not of type 'string'"),
+    ({"uuid": "text", "label": 1234}, "1234 is not of type 'string'"),
+    ({"uuid": "text", "label": "12345678901234567"}, "is too long"),
+    # Good API parameters
+    # mkswap requires valid UUID, but API will accept any string right now.
+    # Bellow will fail when API will be more restricted in the future.
+    ({"uuid": "text"}, ""),
+    ({"uuid": "text", "label": "123456789012"}, ""),
+])
+# This test validates only API calls using correct and incorrect queries
+def test_schema_validation_mkswap(stage_schema, test_data, expected_err):
+    test_input = {
+        "type": STAGE_NAME,
+        "devices": {
+            "device": {
+                "path": "some-path",
+            },
+        },
+        "options": {
+        }
+    }
+    test_input["options"].update(test_data)
+    res = stage_schema.validate(test_input)
+
+    if expected_err == "":
+        assert res.valid is True, f"err: {[e.as_dict() for e in res.errors]}"
+    else:
+        assert res.valid is False
+        testutil.assert_jsonschema_error_contains(res, expected_err, expected_num_errs=1)
+
+
+# This test creates dummy swap using predefined parameters and verifies
+# that end result has those parameters set
+@pytest.mark.skipif(not has_executable("mkswap") or not has_executable("swaplabel"), reason="need mkswap and swaplabel")
+def test_mkswap_integration(tmp_path, stage_module):
+    fake_disk_path = tmp_path / "fake.img"
+    with fake_disk_path.open("w") as fp:
+        fp.truncate(300 * 1024 * 1024)
+    devices = {
+        "device": {
+            "path": fake_disk_path,
+        },
+    }
+    fake_uuid = str(uuid.uuid4())
+    fake_label = "osbuild"
+    options = {
+        "uuid": fake_uuid,
+        "label": fake_label,
+    }
+    stage_module.main(devices, options)
+    assert os.path.exists(fake_disk_path)
+    output = subprocess.check_output([
+        "swaplabel", fake_disk_path], encoding="utf-8")
+    assert f'UUID:  {fake_uuid}' in output, \
+        f'expected UUID not found in: {output}'
+    assert f'LABEL: {fake_label}' in output, \
+        f'expected label not found in: {output}'
+
+
+@pytest.mark.parametrize("test_input, expected", [
+    ({}, []),
+    ({"label": "osbuild"}, ["--label", "osbuild"]),
+])
+@mock.patch("subprocess.run")
+def test_mkswap_cmdline(mock_run, stage_module, test_input, expected):
+    fake_disk_path = "/dev/xxd1"
+    devices = {
+        "device": {
+            "path": fake_disk_path,
+        },
+    }
+    fake_uuid = str(uuid.uuid4())
+    options = {
+        "uuid": fake_uuid,
+    }
+    options.update(test_input)
+    stage_module.main(devices, options)
+
+    expected = [
+        "mkswap",
+        "--uuid",
+        fake_uuid,
+    ] + expected + [
+        fake_disk_path,
+    ]
+    mock_run.assert_called_once_with(expected, encoding="utf8", check=True)