Skip to content

Image Mode Testing

Image mode (bootc) testing runs STS tests on an immutable, container-based RHEL system. Since DNF and COPR are unavailable on image mode, sts-libs and pytest are installed via pip inside a derived bootc image that is built locally on the provisioned system.

How It Works

  1. Testing Farm provisions a Beaker system using an image-mode compose (e.g. RHEL-10.3-image-mode). The base images already include Beaker harness support.

  2. The bootc_additional_packages test runs first (order 1). It reads the currently running bootc image, builds a derived container with sts-libs and pytest installed via pip, and reboots into the new image.

  3. After reboot, the actual STS tests run with sts-libs available.

This follows the kernel-tests misc/bootc-additional-packages pattern. No registry push is needed -- the entire build happens locally.

Running Tests in Image Mode

Using Dedicated Image Mode Plans

The plans/image_mode/ directory has pre-configured plans for each component:

testing-farm request \
  --git-url <sts-repo-url> \
  --plan /plans/image_mode/lvm \
  --compose RHEL-10.3-image-mode \
  --arch x86_64 \
  --context IMAGE_MODE=true \
  --pool beaker

Available plans: lvm.fmf, stratis.fmf, vdo.fmf, dm.fmf, multipath.fmf.

Using Any Existing Plan (no services needed)

For components that do not need to enable systemd services or modify the immutable part of the image, you can run any existing plan in image mode by setting IMAGE_MODE=true. The global adjust rule in plans/main.fmf will automatically install sts-libs and pytest via rpm-ostree install and pip -- no reboot is required.

This method is suitable for components like LVM, DM, or multipath where test packages can be installed at runtime without touching the immutable image layer.

testing-farm request \
  --git-url <sts-repo-url> \
  --plan /plans/lvm/tier1 \
  --compose RHEL-10.3-image-mode \
  --context IMAGE_MODE=true \
  --pool beaker

For components that need services (e.g. Stratis needs stratisd), use the dedicated image mode plans with a component-specific Containerfile instead.

The IMAGE_MODE is defined Adjust Rule

In plans/main.fmf, the adjust rule triggers when IMAGE_MODE is defined:

- when: IMAGE_MODE is defined
  prepare:
   - how: install
     package:
      - python3-pip
      - python3-pytest
     order: 40
   - how: shell
     order: 50
     script:
       - python3 -m pip install sts-libs "pytest-variables[yaml]"

tmt's how: install automatically detects image mode and uses the appropriate package manager (e.g. rpm-ostree install --apply-live) without requiring a reboot. This makes it suitable for components that do not need services or immutable image changes -- packages are layered onto the running system at runtime.

Containerfiles

The tests/bootc_additional_packages/ directory contains Containerfiles used to build derived bootc images. The CONTAINERFILE environment variable selects which file runtest.sh passes to podman build. It defaults to Containerfile if unset.

Base Containerfile

Containerfile installs only the universal test dependencies (python3-pip, rsync, jq) and pip-installs sts-libs, pytest, and pytest-variables. It uses FROM ${BASE_IMAGE} where BASE_IMAGE is the currently running bootc image -- no RHEL version is hardcoded. Use this for components that do not require additional packages or services.

Component-specific Containerfiles

Components that need extra packages or systemd services provide their own Containerfile named Containerfile.<component>. For example, Containerfile.stratis adds stratisd and stratis-cli and enables the stratisd service.

Containerfile Packages Services
Containerfile.stratis stratisd, stratis-cli stratisd

Environment variables

  • CONTAINERFILE -- Containerfile name to use (default: Containerfile)
  • ADDITIONAL_PACKAGES -- extra DNF packages (space-separated)
  • ADDITIONAL_REPO -- extra DNF repo URLs (space-separated)

Creating Image Mode Plans for New Components

  1. If the component needs extra packages or services in the image, create a Containerfile.<component> in tests/bootc_additional_packages/.

  2. Create a new .fmf file in plans/image_mode/ (e.g. stratis.fmf):

    summary: Image mode Stratis tier 1 tests
    environment+:
      CONTAINERFILE: Containerfile.stratis
    discover+:
      - how: fmf
        filter:
          - component:stratis
          - tier:1
    

    For components that do not need a custom Containerfile, omit the environment+ block and the base Containerfile will be used.

  3. The plan inherits from plans/image_mode/main.fmf which provides Artemis/Beaker provisioning and the bootc_additional_packages discover.