Skip to content

[WIP] test: Add integration test running on github runner #1496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

henrywang
Copy link
Collaborator

@henrywang henrywang commented Aug 7, 2025

New integration test workflow:

  • Run integration test in Github runner or run locally with TEST_OS=fedora-42 make test

  • build job:

  1. build bootc binary in container and replace the bootc inside the bootc image
  2. bootc install to-disk to generate disk image
  3. archive disk file (skip this step if run locally), one image can be used by the test jobs in parallel
  • test job:
  1. download disk image from archive
  2. boot disk image with qemu-system
  3. run tmt test against this VM

Copy link
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 a new integration test running on GitHub runners, which is a great addition. The implementation involves new scripts for building a test image and running it in QEMU. My review focuses on improving the robustness and security of these new test scripts. I've identified a few critical issues that would prevent the tests from running as intended, such as an undefined command and incorrect error handling in the presence of set -e. I've also pointed out security concerns regarding disabled TLS verification and opportunities to make the scripts more robust and maintainable. Please see the detailed comments for suggestions.


# This script runs disk image with qemu-system and run tmt against this vm.

BOOTC_TEMPDIR="/tmp/tmp-bootc-build"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The temporary directory path /tmp/tmp-bootc-build is hardcoded here and in build.sh. This creates a tight, implicit coupling between the two scripts. It would be more robust to define this path in one place (e.g., in the Makefile), export it as an environment variable, and have both scripts use it. This would also make it easier to manage the lifecycle of the temporary directory (creation and cleanup).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think we could just require this script to be invoked in the context of the temporary directory.

That said also, the only thing that actually binds the two things together right now is the ssh key.

But we can avoid that by not using --root-ssh-authorized-keys at bootc install to-disk time but instead injecting the SSH key via systemd credentials - that's how podman-bootc does it.

(Of course this whole topic instantly gets into the whole https://gitlab.com/fedora/bootc/tracker/-/issues/2 and whether/how podman-bootc and other virt provisioning tools should be shared underneath different testing frameworks)

Anyways for now though let's just change the GHA to allocate a temporary directory, see below

@henrywang henrywang changed the title test: Add integration test running on github runner [WIP] test: Add integration test running on github runner Aug 7, 2025
@henrywang henrywang force-pushed the qemu_tmt branch 7 times, most recently from 1ce535b to a2def9a Compare August 8, 2025 07:13
@henrywang
Copy link
Collaborator Author

@cgwalters , The two failures still need investigate. It's tmt issue, not our code issue.
Do you have any comment on this PR? Thanks.

runs-on: ubuntu-latest

steps:
- name: Install podman for heredoc support
Copy link
Collaborator

@cgwalters cgwalters Aug 8, 2025

Choose a reason for hiding this comment

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

Unrelated to this PR specifically but we should probably factor this stuff out into a shared action helper

build:
strategy:
matrix:
test_os: [fedora-42]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make this be quay.io/fedora/fedora:42 e.g. - see below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test_os will be [fedora-41, fedora-42, fedora-43, centos-9, centos-10].


# This script runs disk image with qemu-system and run tmt against this vm.

BOOTC_TEMPDIR="/tmp/tmp-bootc-build"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think we could just require this script to be invoked in the context of the temporary directory.

That said also, the only thing that actually binds the two things together right now is the ssh key.

But we can avoid that by not using --root-ssh-authorized-keys at bootc install to-disk time but instead injecting the SSH key via systemd credentials - that's how podman-bootc does it.

(Of course this whole topic instantly gets into the whole https://gitlab.com/fedora/bootc/tracker/-/issues/2 and whether/how podman-bootc and other virt provisioning tools should be shared underneath different testing frameworks)

Anyways for now though let's just change the GHA to allocate a temporary directory, see below

@@ -66,6 +66,9 @@ test-bin-archive: all
test-tmt:
cargo xtask test-tmt

test:
tests/build.sh && tests/test.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this would then become:

tmpd=$(mktemp -d) && cd $tmpd && $srcdir/tests/build.sh && $srcdir/tests/test.sh

or so

@henrywang henrywang force-pushed the qemu_tmt branch 3 times, most recently from 22c2538 to 33c2934 Compare August 11, 2025 09:28
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

I'm OK with this as is if you prefer, we can land further cleanups as followups

@cgwalters
Copy link
Collaborator

     package: building container image with dependencies

We had a live chat about this and I think the fact that tmt is dynamically rebuilding the OS image on boot is a problem. In the long term ideally the testing framework doesn't require installing any binaries at all on the target (this would let us test minimal systems without python etc) but:

  • In the short term how about tmt print-target-dependencies or so and then we can pre-install those in our container image, and then tmt shouldn't require rebuilding inside the target system? i.e. in the Dockerfile we do RUN dnf -y install $(tmt print-target-dependencies)

@henrywang henrywang force-pushed the qemu_tmt branch 3 times, most recently from 0089856 to 7d41270 Compare August 13, 2025 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants