-
Notifications
You must be signed in to change notification settings - Fork 129
[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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
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
1ce535b
to
a2def9a
Compare
@cgwalters , The two failures still need investigate. It's tmt issue, not our code issue. |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Install podman for heredoc support |
There was a problem hiding this comment.
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
.github/workflows/integration.yml
Outdated
build: | ||
strategy: | ||
matrix: | ||
test_os: [fedora-42] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
22c2538
to
33c2934
Compare
Signed-off-by: Xiaofeng Wang <[email protected]>
There was a problem hiding this 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
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:
|
eac749f
to
07ef754
Compare
Signed-off-by: Xiaofeng Wang <[email protected]>
0089856
to
7d41270
Compare
Signed-off-by: Xiaofeng Wang <[email protected]>
Signed-off-by: Xiaofeng Wang <[email protected]>
New integration test workflow:
Run integration test in Github runner or run locally with
TEST_OS=fedora-42 make test
build job: