Skip to content

Improve test coverage for prepare plugins in image mode#4719

Open
thrix wants to merge 15 commits intomainfrom
issue-4606
Open

Improve test coverage for prepare plugins in image mode#4719
thrix wants to merge 15 commits intomainfrom
issue-4606

Conversation

@thrix
Copy link
Copy Markdown
Contributor

@thrix thrix commented Mar 19, 2026

Incorporate the image mode testing into the plugins' tests and remove the separate bootc specific testing.
Running the plugins test exercises all the cases as in package mode and provides good confidence about the
image mode testing support.

The testing is done against F44 and CS10 image mode cloud base images provided by Testing Farm.

Run the testing in a separate /provision/virtual-image-mode plan, because the testing will similar
time to run as /provision/virtual.

Fixes #4606

Pull Request Checklist

  • implement the feature
  • extend the test coverage

Assisted-by: Claude Code

@thrix thrix added test coverage Improvements or additions to test coverage of tmt itself ci | full test Pull request is ready for the full test execution plugin | install The prepare plugin for installing packages labels Mar 19, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves test coverage for prepare plugins in image mode by refactoring existing tests and adding new ones for bootc-based guests. It also implements missing methods in the Bootc package manager to support these tests. The changes are well-structured and the new test infrastructure is a valuable addition. I have one suggestion to simplify some of the new shell helper functions for better readability.

Comment thread tests/images.sh Outdated
@thrix thrix marked this pull request as draft March 19, 2026 07:42
@github-project-automation github-project-automation bot moved this to backlog in planning Mar 19, 2026
@LecrisUT LecrisUT moved this from backlog to implement in planning Mar 19, 2026
@thrix thrix force-pushed the issue-4606 branch 2 times, most recently from 65f03c7 to 022036b Compare March 22, 2026 12:05
Comment thread plans/provision/virtual.fmf Outdated
@thrix thrix marked this pull request as ready for review March 23, 2026 12:15
@thrix thrix moved this from implement to review in planning Mar 23, 2026
@thrix thrix requested review from LecrisUT, happz and psss March 24, 2026 00:17
@psss psss added this to the 1.70 milestone Mar 24, 2026
Comment thread plans/provision/virtual.fmf Outdated
Comment thread plans/provision/virtual.fmf Outdated
Comment thread plans/provision/virtual.fmf Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment thread .packit.yaml Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment on lines -177 to +213
if [ "$PROVISION_HOW" = "container" ] && rlIsFedora 43 && is_fedora_43 "$image"; then
if ([ "$PROVISION_HOW" = "container" ] && rlIsFedora 43 && is_fedora_43 "$image") || is_image_mode "$image"; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should a special is_image_mode here be done?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original condition was container-only. Image mode was added because it supports local RPM installation via a different code path (Containerfile COPY + RUN dnf install), which is worth testing separately from repo-based installation.

This comment was marked as duplicate.

Copy link
Copy Markdown
Contributor Author

@thrix thrix Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I am not sure where the confusion is, but the below tests run only against a container provisioner now. I want to run them on image mode, because they handling is special there and it is worth testing. Also, one of the cases tested should be testing the case we fixed in https://github.com/teemtee/tmt/pull/4598/files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then put it next to the PROVSION_HOW check, not globally or-ed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would not match rlIsFedora 43 && is_fedora_43 "$image" ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would not match rlIsFedora 43 && is_fedora_43 "$image" ...

Yes, I'm aware, and that's a separate issue to be resolved for the exact same reasons.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am lost what do you want here, please provide a snippet. We want to run this:

  1. one of the container images (fedora 43 now)
  2. on image mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the intent in this section is unclear and the change looks more like slapping a duct-tape on top of a pile of duct-tapes. If we come back to re-organizing this test, how should this be split, what is meaningful to run, etc., it would make our future selves jobs easier.

Comment thread tests/prepare/install/test.sh Outdated
@thrix thrix requested review from LecrisUT and thrix-bot March 26, 2026 01:09
@thrix
Copy link
Copy Markdown
Contributor Author

thrix commented Mar 26, 2026

@gemini-code-assist please review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive support for 'image-mode' guests within the TMT framework. Key changes include updating .packit.yaml and plans/provision/virtual.fmf to define a new provision-virtual-image-mode job and FMF plan, along with adding specific image definitions and helper functions in tests/images.sh. The testing infrastructure has been significantly adapted across tests/prepare/install/test.sh, tests/prepare/recommend/test.sh, and tests/prepare/shell/test.sh to accommodate image-mode specific behaviors like Containerfile builds, image switches, and reboot persistence. Core package management logic for image-mode guests, including COPR repository handling and package installation, has been implemented in tmt/package_managers/bootc.py. Several old test files related to bootc and CentOS Stream 10 have been removed.

@thrix thrix force-pushed the issue-4606 branch 2 times, most recently from 0a72ea2 to 221d6c3 Compare March 26, 2026 02:29
Comment thread .packit.yaml Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment thread tests/prepare/recommend/test.sh
Comment thread tests/prepare/install/test.sh Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment thread tests/prepare/install/test.sh Outdated
Comment on lines -177 to +213
if [ "$PROVISION_HOW" = "container" ] && rlIsFedora 43 && is_fedora_43 "$image"; then
if ([ "$PROVISION_HOW" = "container" ] && rlIsFedora 43 && is_fedora_43 "$image") || is_image_mode "$image"; then

This comment was marked as duplicate.

@thrix-bot
Copy link
Copy Markdown

Fixed the provision-virtual-image-mode test failures:

Assisted-by: Claude Code

@LecrisUT

This comment was marked as resolved.

@thrix thrix moved this from review to implement in planning Apr 1, 2026
@LecrisUT
Copy link
Copy Markdown
Member

LecrisUT commented Apr 7, 2026

Btw, what do we do with the diverging naming conventions bootc vs image-mode. Shouldn't this be provision-virtual-bootc?

@thrix
Copy link
Copy Markdown
Contributor Author

thrix commented Apr 8, 2026

Btw, what do we do with the diverging naming conventions bootc vs image-mode. Shouldn't this be provision-virtual-bootc?

I would opt calling this image-mode to mitigate the confusion with the bootc provision plugin. It already caused that confusion at the beginning of this review.

@LecrisUT
Copy link
Copy Markdown
Member

LecrisUT commented Apr 8, 2026

Btw, what do we do with the diverging naming conventions bootc vs image-mode. Shouldn't this be provision-virtual-bootc?

I would opt calling this image-mode to mitigate the confusion with the bootc provision plugin. It already caused that confusion at the beginning of this review.

Did it create a confusion? Isn't the whole point of virtual-(bootc|image-mode) to disambiguate it. To me it would feel more confusing down the line as if we are distinguishing between bootc and image-mode. Another option is virtual-with-bootc

thrix and others added 12 commits April 17, 2026 03:14
Remove standalone `tests/prepare/bootc/` and extend existing plugin
tests (`prepare/install`, `prepare/shell`, `prepare/recommend`) with
image mode coverage on CentOS Stream 10 and Fedora 44 bootc images.

- `enable_copr()` — installs copr plugin via Containerfile (since
  `/usr` is read-only), then runs `dnf copr enable` on the live
  system to write `.repo` to `/etc`.

- `create_repository()`, `install_repository()` — delegate to
  `aux_engine` to run on the live system. Not directly tested,
  will be exercised when `prepare/artifact` tests are extended.

Existing tests gain `IS_IMAGE_MODE` handling and run against
image mode images when triggered by the new
`/plans/provision/virtual/image-mode` sub-plan.

Reboot persistence is verified through a dedicated
`reboot-persistence` inner plan that installs packages, reboots
via `tmt-reboot`, and re-verifies. A single reboot test is
sufficient — all install variants (repo, local RPM, COPR, etc.)
go through the same bootc mechanism (Containerfile rebuild →
`bootc switch` → reboot), so if packages survive a reboot in
one case, they survive in all.

- `prepare/artifact`, `prepare/require` — currently
  `provision-container` only
- `prepare/ansible`, `prepare/feature/epel,fips,profile` —
  need Ansible support in image mode (#4636)
- `prepare/distgit` — test refactoring needed

Pull Request Checklist

* [x] implement the feature
* [x] extend the test coverage

Assisted-by: Claude Code
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Co-authored-by: Cristian Le <git@lecris.dev>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Script from remote url is broken, see #4785

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
thrix added 3 commits April 17, 2026 03:48
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution plugin | install The prepare plugin for installing packages test coverage Improvements or additions to test coverage of tmt itself

Projects

Status: implement

Development

Successfully merging this pull request may close these issues.

Improve test coverage for prepare plugins in image mode

5 participants