diff --git a/Justfile b/Justfile index c3cf9bb3..7e990442 100644 --- a/Justfile +++ b/Justfile @@ -350,20 +350,46 @@ show-me-the-future: just export-installer just test-installer-artifact +# INSTALLER_BOOT_MODE selects how the installer itself is started: +# usb (default) — firmware (OVMF) boots the raw image off an emulated xHCI USB +# drive, the bare-metal USB install path. +# pxe — QEMU boots the exported PXE vmlinuz/initrd pair directly with +# -kernel/-initrd/-append, the network install path. +# Everything after the install (target partition check, booting the installed +# system, kiosk readiness probe) is identical for both modes. # Install and reboot already-exported server artifacts in QEMU. [group('test')] test-installer-artifact: #!/usr/bin/env bash set -euo pipefail + BOOT_MODE="${INSTALLER_BOOT_MODE:-usb}" + case "${BOOT_MODE}" in + usb|pxe) ;; + *) echo "ERROR: INSTALLER_BOOT_MODE must be 'usb' or 'pxe', got '${BOOT_MODE}'." >&2; exit 1 ;; + esac + CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}" mkdir -p "$CACHE_DIR" WORKDIR="$(mktemp -d "${CACHE_DIR}/bluefin-show-future.XXXXXX")" trap 'rm -rf "$WORKDIR"' EXIT + # The raw installer image is always needed; usb mode boots it through firmware + # so it consumes nothing else. The PXE vmlinuz/initrd pair is only copied in pxe + # mode, because copying it unconditionally would fail the usb test on hosts that + # have the installer image but no PXE artifacts. cp dist/bluefin-server-installer-*.raw.zst "$WORKDIR/installer.raw.zst" - cp dist/bluefin-server-pxe-vmlinuz-* "$WORKDIR/installer.vmlinuz" - cp dist/bluefin-server-pxe-initrd-*.cpio.gz "$WORKDIR/installer.initrd" + if [ "${BOOT_MODE}" = "pxe" ]; then + PXE_KERNEL=$(find dist/ -maxdepth 1 -type f -name 'bluefin-server-pxe-vmlinuz-*' | head -n1) + PXE_INITRD=$(find dist/ -maxdepth 1 -type f -name 'bluefin-server-pxe-initrd-*.cpio.gz' | head -n1) + if [ -z "${PXE_KERNEL}" ] || [ -z "${PXE_INITRD}" ]; then + echo "ERROR: INSTALLER_BOOT_MODE=pxe needs an exported PXE kernel and initrd in dist/." >&2 + echo "Please run: just build-installer && just export-pxe" >&2 + exit 1 + fi + cp "${PXE_KERNEL}" "$WORKDIR/installer.vmlinuz" + cp "${PXE_INITRD}" "$WORKDIR/installer.initrd" + fi zstd -d "$WORKDIR/installer.raw.zst" -o "$WORKDIR/installer.raw" TARGET_SIZE="${SHOW_ME_THE_FUTURE_DISK_SIZE:-16G}" truncate -s "${TARGET_SIZE}" "$WORKDIR/target.raw" @@ -393,42 +419,102 @@ test-installer-artifact: OVMF_VARS=$(first_existing \ /home/linuxbrew/.linuxbrew/Cellar/qemu/*/share/qemu/edk2-x86_64-vars.fd \ + /home/linuxbrew/.linuxbrew/Cellar/qemu/*/share/qemu/edk2-i386-vars.fd \ /usr/share/edk2/ovmf/OVMF_VARS.fd \ /usr/share/OVMF/OVMF_VARS.fd \ /usr/share/OVMF/OVMF_VARS_4M.fd \ /usr/share/edk2/x64/OVMF_VARS.4m.fd \ /usr/share/qemu/edk2-x86_64-vars.fd \ + /usr/share/qemu/edk2-i386-vars.fd \ /usr/share/qemu/OVMF_VARS.fd) \ || true - if [ -n "$OVMF_VARS" ]; then + if [ -n "${OVMF_VARS}" ]; then cp "$OVMF_VARS" "$WORKDIR/ovmf-vars.fd" else + # Hosts that ship only OVMF_CODE still boot: firmware initialises a blank + # variable store on first use, it just has no preseeded boot entries. + echo "WARNING: no OVMF_VARS template found; using a blank variable store sized to $OVMF_CODE" >&2 truncate -s "$(stat -c '%s' "$OVMF_CODE")" "$WORKDIR/ovmf-vars.fd" fi SMP_CPUS="${SHOW_ME_THE_FUTURE_SMP:-$(nproc)}" MEM_SIZE="${SHOW_ME_THE_FUTURE_MEM:-8192}" - echo "==> Booting installer media in QEMU..." + echo "==> Booting installer media in QEMU (mode: ${BOOT_MODE})..." # ponytail: we want QEMU to exit cleanly after install. Since QEMU's -no-reboot # suspends/halts on reboot signals, we override systemd-sysinstall.service SuccessAction/FailureAction # to poweroff. When the installer triggers poweroff, QEMU terminates, and we boot into the newly installed OS. - qemu-system-x86_64 \ - -enable-kvm \ - -m "${MEM_SIZE}" \ - -cpu host \ - -smp "${SMP_CPUS}" \ - -drive file="$WORKDIR/installer.raw",format=raw,if=virtio,readonly=on \ - -drive file="$WORKDIR/target.raw",format=raw,if=virtio \ - -drive if=pflash,format=raw,readonly=on,file="$OVMF_CODE" \ - -drive if=pflash,format=raw,file="$WORKDIR/ovmf-vars.fd" \ - -kernel "$WORKDIR/installer.vmlinuz" \ - -initrd "$WORKDIR/installer.initrd" \ - -append "systemd.unit=system-install.target console=tty0 console=ttyS0,115200 rw unattended" \ + INSTALLER_TIMEOUT="${SHOW_ME_THE_FUTURE_INSTALL_TIMEOUT:-600}" + INSTALL_ARGS=( + -enable-kvm + -m "${MEM_SIZE}" + -cpu host + -smp "${SMP_CPUS}" + -drive if=pflash,format=raw,readonly=on,file="$OVMF_CODE" + -drive if=pflash,format=raw,file="$WORKDIR/ovmf-vars.fd" + ) + if [ "${BOOT_MODE}" = "usb" ]; then + # Firmware boots the image's own bootloader, so the unattended flag has to + # reach the UKI through systemd-stub rather than QEMU's -append. + # + # NOTE: systemd-stub deliberately ignores io.systemd.stub.kernel-cmdline-extra + # when Secure Boot is enabled, because the SMBIOS string is not covered by the + # signature. Point $OVMF_CODE at a secure-boot firmware build and this run + # boots interactive instead of unattended, then sits there until + # SHOW_ME_THE_FUTURE_INSTALL_TIMEOUT expires with a misleading "install did + # not finish" failure. Use INSTALLER_BOOT_MODE=pxe (-append is always honoured) + # to exercise unattended installs under Secure Boot firmware. + INSTALL_ARGS+=( + -device qemu-xhci,id=xhci + -drive file="$WORKDIR/installer.raw",format=raw,if=none,id=installer-disk,readonly=on + -device usb-storage,bus=xhci.0,drive=installer-disk,bootindex=1 + -drive file="$WORKDIR/target.raw",format=raw,if=none,id=target-disk + -device virtio-blk-pci,drive=target-disk,bootindex=2 + -smbios "type=11,value=io.systemd.stub.kernel-cmdline-extra=console=tty0 console=ttyS0,,115200 rw unattended" + ) + else + INSTALL_ARGS+=( + -drive file="$WORKDIR/installer.raw",format=raw,if=virtio,readonly=on + -drive file="$WORKDIR/target.raw",format=raw,if=virtio + -kernel "$WORKDIR/installer.vmlinuz" + -initrd "$WORKDIR/installer.initrd" + -append "systemd.unit=system-install.target console=tty0 console=ttyS0,115200 rw unattended" + ) + fi + timeout "${INSTALLER_TIMEOUT}" qemu-system-x86_64 \ + "${INSTALL_ARGS[@]}" \ -nographic \ -serial mon:stdio \ -no-reboot < /dev/null + echo "==> Validating target disk partitions after installer execution..." + for tool in sfdisk jq; do + command -v "$tool" >/dev/null 2>&1 \ + || { echo "ERROR: '$tool' is required to validate the target disk layout but is not installed." >&2; exit 1; } + done + + # Keep sfdisk and jq failures distinguishable from "the installer did not + # partition the disk", otherwise a broken host tool is misreported as a + # failed install. + if ! TARGET_TABLE=$(sfdisk --json "$WORKDIR/target.raw"); then + echo "ERROR: sfdisk could not read a partition table from $WORKDIR/target.raw!" >&2 + sfdisk -l "$WORKDIR/target.raw" >&2 || true + exit 1 + fi + if ! TARGET_PARTS=$(jq -r '.partitiontable.partitions[]?.name // empty' <<<"$TARGET_TABLE"); then + echo "ERROR: jq failed to parse the sfdisk JSON output!" >&2 + echo "$TARGET_TABLE" >&2 + exit 1 + fi + if ! echo "$TARGET_PARTS" | grep -Fxq 'bluefin-server-root-a' || \ + ! echo "$TARGET_PARTS" | grep -Fxq 'var'; then + echo "ERROR: Target disk did not receive expected partition layout from installer!" >&2 + echo "Observed partitions:" >&2 + echo "$TARGET_PARTS" >&2 + sfdisk -l "$WORKDIR/target.raw" >&2 || true + exit 1 + fi + echo "==> Target disk successfully partitioned and populated!" SERIAL_LOG="$WORKDIR/serial.log" TARGET_QEMU_PID="" cleanup() { @@ -521,6 +607,20 @@ test-installer-artifact: sleep 2 done +# This is the default mode of test-installer-artifact; the recipe exists so the USB +# boot path is discoverable by name. +# Boot the exported installer media via firmware (OVMF) as an xHCI USB drive. +[group('test')] +test-installer-boot-usb: + INSTALLER_BOOT_MODE=usb just test-installer-artifact + +# `just export-pxe` only checks that the two files exist, so this recipe is the only +# thing that proves they still boot and install. +# Boot the exported PXE kernel/initrd pair directly (QEMU -kernel/-initrd/-append). +[group('test')] +test-installer-boot-pxe: + INSTALLER_BOOT_MODE=pxe just test-installer-artifact + # Interactively install and boot a persistent local KubeStellar kiosk VM. [group('test')] install-vm: @@ -559,16 +659,21 @@ install-vm: if [ ! -f "$OVMF_VARS" ]; then OVMF_TEMPLATE=$(first_existing \ /home/linuxbrew/.linuxbrew/Cellar/qemu/*/share/qemu/edk2-x86_64-vars.fd \ + /home/linuxbrew/.linuxbrew/Cellar/qemu/*/share/qemu/edk2-i386-vars.fd \ /usr/share/edk2/ovmf/OVMF_VARS.fd \ /usr/share/OVMF/OVMF_VARS.fd \ /usr/share/OVMF/OVMF_VARS_4M.fd \ /usr/share/edk2/x64/OVMF_VARS.4m.fd \ /usr/share/qemu/edk2-x86_64-vars.fd \ + /usr/share/qemu/edk2-i386-vars.fd \ /usr/share/qemu/OVMF_VARS.fd) \ || true - if [ -n "$OVMF_TEMPLATE" ]; then + if [ -n "${OVMF_TEMPLATE}" ]; then cp "$OVMF_TEMPLATE" "$OVMF_VARS" else + # Hosts that ship only OVMF_CODE still boot: firmware initialises a blank + # variable store on first use, it just has no preseeded boot entries. + echo "WARNING: no OVMF_VARS template found; using a blank variable store sized to $OVMF_CODE" >&2 truncate -s "$(stat -c '%s' "$OVMF_CODE")" "$OVMF_VARS" fi fi diff --git a/docs/skills/ci-tooling.md b/docs/skills/ci-tooling.md index c4deaf91..57346063 100644 --- a/docs/skills/ci-tooling.md +++ b/docs/skills/ci-tooling.md @@ -137,7 +137,7 @@ uploaded to a GitHub Release tagged `installer-v`. result as its own pull request against `main`. 3. **Full Compilation:** Builds the standalone DDI OS image, live installer, and k0s systemd-sysext on every pull request and push to `main`. -4. **Installer boot test:** Uploads the already-built installer and PXE artifacts and calls `projectbluefin/actions/.github/workflows/server-installer-test.yml`. The shared workflow prepares QEMU/KVM and runs this repository's `just test-installer-artifact`; Lima remains local-only. +4. **Installer boot test:** Uploads the already-built installer and PXE artifacts and calls `projectbluefin/actions/.github/workflows/server-installer-test.yml`. The shared workflow prepares QEMU/KVM and runs this repository's `just test-installer-artifact`, which defaults to the USB/firmware boot path and consumes only the raw installer image; the uploaded PXE pair is exercised by `just test-installer-boot-pxe` (`INSTALLER_BOOT_MODE=pxe`). Lima remains local-only. 5. **Version Derivation:** The release tag is derived with `just version`, which parses the pinned FSDK point release from `elements/freedesktop-sdk.bst`. 6. **Automated Publishing:** For pushes to `main` (including Renovate PR merges), diff --git a/docs/skills/ddi-installer-build.md b/docs/skills/ddi-installer-build.md index 167bd780..b3c11158 100644 --- a/docs/skills/ddi-installer-build.md +++ b/docs/skills/ddi-installer-build.md @@ -31,9 +31,33 @@ just export-sysext # export sysext artifacts to dist/sysext/ just flash-installer # write the installer image to a USB device just show-me-the-future # end-to-end QEMU installer smoke test just test-installer-artifact # test already-exported artifacts in QEMU without rebuilding +just test-installer-boot-usb # test-installer-artifact in USB/firmware boot mode +just test-installer-boot-pxe # test-installer-artifact in PXE -kernel/-initrd boot mode just tags # show FSDK-derived version tags ``` +`just test-installer-artifact` boots the exported raw installer image through OVMF +firmware as an emulated xHCI USB drive (`-device qemu-xhci` plus `-device usb-storage`), +with the target disk on virtio-blk. This is the bare-metal USB install path: firmware +picks the bootloader off the image itself rather than QEMU injecting a kernel through +`-kernel`/`-initrd`. The boot method is selected by `INSTALLER_BOOT_MODE` (`usb`, the +default, or `pxe`); everything after the install is identical for both. `just +test-installer-boot-usb` and `just test-installer-boot-pxe` are the named entry points. + +Use `pxe` mode to exercise the exported `bluefin-server-pxe-vmlinuz-*` / +`bluefin-server-pxe-initrd-*.cpio.gz` pair, which is booted with `-kernel`/`-initrd` +and an explicit `-append` command line. `just export-pxe` only asserts that those two +files exist, so the PXE recipe is what proves they still boot and install. PXE mode is +also the way to test an unattended install under Secure Boot firmware: in USB mode the +unattended flag travels via `-smbios type=11 io.systemd.stub.kernel-cmdline-extra`, and +systemd-stub ignores that credential when Secure Boot is enabled. + +The recipe prefers a real `OVMF_VARS` template but falls back to a blank variable store +sized to `OVMF_CODE` on hosts that ship CODE only, so a missing template is a warning +rather than a hard failure. It needs `qemu-system-x86_64`, `zstd`, `sfdisk` and `jq` on +the host; the last two are used to assert that the installer actually partitioned the +target disk, and the recipe fails with a named error if either is missing. + ### Payload base `build-ddi` takes an optional `os-base` argument selecting which payload it diff --git a/elements/oci/bluefin-server-installer.bst b/elements/oci/bluefin-server-installer.bst index 5999abe2..3373a1b3 100644 --- a/elements/oci/bluefin-server-installer.bst +++ b/elements/oci/bluefin-server-installer.bst @@ -188,6 +188,25 @@ config: #!/bin/bash set -euo pipefail + CMDLINE="$(< /proc/cmdline)" + + # The service drop-in uses StandardOutput=journal+console so unattended runs + # land on the serial console that automated tests capture. /dev/console follows + # the last console= argument, which is ttyS0, so an interactive bare-metal + # install would otherwise print to serial rather than the attached display. + # Keep the interactive installer on the attached display by redirecting this + # script's own output to /dev/tty0 — but only when the kernel actually drives + # tty0 as a console. On serial-only machines the VT device still exists and is + # writable, so a -w test alone would send the whole install to a display nobody + # is watching; /sys/class/tty/console/active lists the consoles the kernel + # really registered, and omits tty0 when the boot was serial-only. If that file + # is unreadable the redirect is skipped and output stays on journal+console. + if [[ " ${CMDLINE} " != *" unattended "* ]] \ + && [ -w /dev/tty0 ] \ + && grep -qw tty0 /sys/class/tty/console/active 2>/dev/null; then + exec > /dev/tty0 2>&1 + fi + # Ensure storage controller modules and filesystems are loaded before probing devices modprobe -q nvme || true modprobe -q nvme_core || true @@ -265,9 +284,22 @@ config: # bluefin-installer-data partition. Under PXE (inst.ddi_url=) there is no # installer media, so the check is skipped when inst.ddi_url is set. if [ -z "${DDI_URL}" ]; then + # Hard preflight: wait up to 30s for storage settle and installer data partition to become available INSTALLER_PART_PATH="/dev/disk/by-partlabel/bluefin-installer-data" + DEADLINE=$((SECONDS + 30)) + udevadm trigger --subsystem-match=block || true + udevadm settle --timeout=5 || true + while [ ! -b "${INSTALLER_PART_PATH}" ] && [ "${SECONDS}" -lt "${DEADLINE}" ]; do + sleep 1 + udevadm trigger --subsystem-match=block || true + REMAINING=$((DEADLINE - SECONDS)) + [ "${REMAINING}" -gt 0 ] || break + SETTLE_TIMEOUT=$(( REMAINING < 5 ? REMAINING : 5 )) + udevadm settle --timeout="${SETTLE_TIMEOUT}" || true + done + if [ ! -b "${INSTALLER_PART_PATH}" ]; then - echo "ERROR: Installer data partition '${INSTALLER_PART_PATH}' is missing or not a block device!" >&2 + echo "ERROR: Installer data partition '${INSTALLER_PART_PATH}' is missing or not a block device after 30s deadline!" >&2 echo "==> Block devices visible at failure:" >&2 lsblk -p -o NAME,TYPE,PARTLABEL,PKNAME,SIZE,FSTYPE >&2 || true echo "==> Partition label symlinks visible under /dev/disk/by-partlabel/:" >&2 @@ -275,8 +307,8 @@ config: exit 1 fi INSTALLER_PART="$(readlink -f "${INSTALLER_PART_PATH}")" + echo "==> Found installer partition at ${INSTALLER_PART_PATH} -> ${INSTALLER_PART}" fi - # Auto-detect target disk for unattended install (any raw disk of type "disk" that is not the installer, is not read-only, and has size > 0) TARGET_DISK="" while read -r name type ro size; do @@ -343,6 +375,7 @@ config: fi } + # Check for unattended in kernel command line if [[ " ${CMDLINE} " == *" unattended "* ]]; then echo "==> Running in UNATTENDED mode..." if [ -n "${TARGET_DISK}" ]; then @@ -387,8 +420,13 @@ config: FailureAction=poweroff [Service] - # Keep the interactive installer on the attached display. The kernel - # still uses the final serial console for boot diagnostics. + # Mirror installer service output to journal+console so progress and diagnostics + # are captured on the serial console in headless/automated test runs. TTYPath is + # only honoured for Standard*=tty, so it does not steer this output; the wrapper + # keeps the interactive installer on the attached display by redirecting itself + # to /dev/tty0 when 'unattended' is absent from the kernel command line. + StandardOutput=journal+console + StandardError=journal+console TTYPath=/dev/tty0 ExecStart= ExecStart=/usr/bin/bluefin-sysinstall diff --git a/tests/unit/test-installer-artifact_test.bats b/tests/unit/test-installer-artifact_test.bats index 173a7925..34398fd3 100755 --- a/tests/unit/test-installer-artifact_test.bats +++ b/tests/unit/test-installer-artifact_test.bats @@ -86,6 +86,7 @@ setup() { make_zstd_stub make_qemu_stub make_curl_stub + make_sfdisk_stub } # The OVMF_CODE lookup (`Justfile:254`, duplicated verbatim at the same @@ -135,6 +136,35 @@ exit 0 EOF chmod +x "${STUB_DIR}/zstd" } +make_sfdisk_stub() { + cat > "${STUB_DIR}/sfdisk" <> "${LOG}" +for ((i = 1; i <= \$#; i++)); do + arg="\${!i}" + if [ "\$arg" = "--json" ]; then + cat <<'JSON' +{ + "partitiontable": { + "label": "gpt", + "id": "12345678-1234-1234-1234-123456789abc", + "device": "target.raw", + "unit": "sectors", + "partitions": [ + {"node": "target.raw1", "start": 2048, "size": 204800, "type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "name": "ESP"}, + {"node": "target.raw2", "start": 206848, "size": 8388608, "type": "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "name": "bluefin-server-root-a"}, + {"node": "target.raw3", "start": 8595456, "size": 8388608, "type": "4D21B016-B534-45C2-A9FB-5C16E091FD2D", "name": "var"} + ] + } +} +JSON + exit 0 + fi +done +exit 0 +EOF + chmod +x "${STUB_DIR}/sfdisk" +} # make_qemu_stub # diff --git a/tests/unit/test_installer_contract.py b/tests/unit/test_installer_contract.py index 114df0b3..e1f9eeab 100644 --- a/tests/unit/test_installer_contract.py +++ b/tests/unit/test_installer_contract.py @@ -50,6 +50,13 @@ def test_installer_runtime_and_boot_contracts() -> None: assert "console=ttyS0,115200 rw" in installer_element assert "unattended" not in published_uki_cmdline assert target_uki_cmdline == "rw console=ttyS0,115200 console=tty0 quiet loglevel=3 audit=0" + assert "test-installer-artifact:" in justfile + assert "-device qemu-xhci,id=xhci" in justfile + assert "-device usb-storage,bus=xhci.0,drive=installer-disk,bootindex=1" in justfile + assert "-device virtio-blk-pci,drive=target-disk,bootindex=2" in justfile + assert 'sfdisk --json "$WORKDIR/target.raw"' in justfile + assert "bluefin-server-root-a" in justfile + # The PXE pair is still exported, so the direct-kernel boot path stays covered. assert ( '-append "systemd.unit=system-install.target ' 'console=tty0 console=ttyS0,115200 rw unattended"' @@ -119,7 +126,7 @@ def test_installer_loads_storage_drivers_and_settles_udev() -> None: assert "modprobe -q nvme_core || true" in installer_element assert "modprobe -q usb-storage || true" in installer_element assert "modprobe -q uas || true" in installer_element - assert "udevadm settle --timeout=15 || true" in installer_element + assert 'udevadm settle --timeout="${SETTLE_TIMEOUT}" || true' in installer_element assert "After=systemd-udev-settle.service" in installer_element assert "Wants=systemd-udev-settle.service" in installer_element @@ -127,14 +134,29 @@ def test_installer_loads_storage_drivers_and_settles_udev() -> None: def test_installer_hard_preflight_aborts_on_missing_installer_data_part() -> None: installer_element = INSTALLER_ELEMENT.read_text(encoding="utf-8") + assert 'DEADLINE=$((SECONDS + 30))' in installer_element + assert 'while [ ! -b "${INSTALLER_PART_PATH}" ] && [ "${SECONDS}" -lt "${DEADLINE}" ]; do' in installer_element assert '[ ! -b "${INSTALLER_PART_PATH}" ]' in installer_element assert "/dev/disk/by-partlabel/bluefin-installer-data" in installer_element assert "lsblk -p -o NAME,TYPE,PARTLABEL,PKNAME,SIZE,FSTYPE" in installer_element + def test_interactive_installer_uses_local_virtual_console() -> None: installer_element = INSTALLER_ELEMENT.read_text(encoding="utf-8") assert "TTYPath=/dev/tty0" in installer_element + assert "StandardOutput=journal+console" in installer_element + assert "StandardError=journal+console" in installer_element + # journal+console follows the last console= argument (ttyS0), so the wrapper has + # to put interactive runs back on the attached display itself — but only when the + # kernel actually registered tty0 as a console, otherwise serial-only machines + # lose the install output to a VT nobody is watching. + assert ( + 'if [[ " ${CMDLINE} " != *" unattended "* ]] \\\n' + " && [ -w /dev/tty0 ] \\\n" + " && grep -qw tty0 /sys/class/tty/console/active 2>/dev/null; then\n" + " exec > /dev/tty0 2>&1" + ) in installer_element def test_installer_and_ddi_strip_vmlinux_and_static_archives() -> None: @@ -208,3 +230,22 @@ def test_installer_smoke_probes_the_kiosk_over_tls_from_inside_the_guest() -> No assert "http://127.0.0.1:8080/healthz" not in smoke assert "KIOSK_CONSOLE_READY" in smoke + +def test_test_installer_boot_usb_contract() -> None: + justfile = JUSTFILE.read_text(encoding="utf-8") + start = justfile.index("test-installer-boot-usb:") + end = justfile.index("test-installer-boot-pxe:", start) + recipe = justfile[start:end] + assert "INSTALLER_BOOT_MODE=usb just test-installer-artifact" in recipe + + +def test_test_installer_boot_pxe_recipe_exercises_direct_kernel_boot() -> None: + justfile = JUSTFILE.read_text(encoding="utf-8") + start = justfile.index("test-installer-boot-pxe:") + end = justfile.index("install-vm:", start) + recipe = justfile[start:end] + assert "INSTALLER_BOOT_MODE=pxe just test-installer-artifact" in recipe + assert '-kernel "$WORKDIR/installer.vmlinuz"' in justfile + assert '-initrd "$WORKDIR/installer.initrd"' in justfile + assert "bluefin-server-pxe-vmlinuz-*" in justfile + assert "bluefin-server-pxe-initrd-*.cpio.gz" in justfile