Skip to content

Commit 732ecb2

Browse files
committed
tmt: add test test-bootc-install-on-ostree on FCOS
Signed-off-by: Huijing Hei <[email protected]>
1 parent fa5ce7e commit 732ecb2

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,28 @@ jobs:
212212
name: tmt-log-PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ matrix.variant }}-${{ env.ARCH }}
213213
path: /var/tmp/tmt
214214

215+
test-bootc-install-on-ostree:
216+
name: "Test install on ostree"
217+
runs-on: ubuntu-24.04
218+
steps:
219+
- name: Checkout repository
220+
uses: actions/checkout@v6
221+
- name: Bootc Ubuntu Setup
222+
uses: ./.github/actions/bootc-ubuntu-setup
223+
- name: Install tmt
224+
run: pip install --user "tmt[provision-virtual]"
225+
226+
- name: Run TMT
227+
run: |
228+
podman image prune -f && podman rmi localhost/bootc{,-bin} -f
229+
env BOOTC_base=quay.io/fedora/fedora-bootc:43 just build
230+
podman image exists localhost/bootc && \
231+
podman save -q localhost/bootc:latest -o tmt/tests/examples/bootc.tar
232+
podman image prune -f && podman rmi localhost/bootc -f
233+
tmt run plans -n /tmt/plans/test-install/plan-bootc-install-on-ostree --debug
234+
tmt clean images
235+
rm -f tmt/tests/examples/bootc.tar
236+
215237
# Sentinel job for required checks - configure this job name in repository settings
216238
required-checks:
217239
if: always()

.packit.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ jobs:
8383
context:
8484
running_env: "packit"
8585

86+
- job: tests
87+
trigger: pull_request
88+
targets:
89+
- fedora-43-x86_64
90+
tmt_plan: /tmt/plans/bootc-install-on-ostree
91+
tf_extra_params:
92+
environments:
93+
- tmt:
94+
context:
95+
running_env: "existing-ostree"
96+
8697
- job: propose_downstream
8798
trigger: release
8899
dist_git_branches:

tmt/plans/tests-install.fmf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
discover:
2+
how: fmf
3+
provision:
4+
how: virtual
5+
hardware:
6+
boot:
7+
method: uefi
8+
image: fedora-coreos-next
9+
user: root
10+
memory: 4096
11+
disk: 20
12+
execute:
13+
how: tmt
14+
15+
/plan-bootc-install-on-ostree:
16+
summary: Execute bootc install on ostree tests
17+
discover:
18+
how: fmf
19+
test:
20+
- /tmt/tests/install/test-bootc-install-on-ostree
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# number: 50
2+
# tmt:
3+
# summary: Test bootc install on ostree env
4+
# duration: 30m
5+
# adjust:
6+
# - when: running_env != existing-ostree
7+
# enabled: false
8+
# because: this needs to start an ostree OS firstly
9+
#
10+
#!/bin/bash
11+
set -eux
12+
13+
echo "Testing bootc install on stree"
14+
15+
bootc_img=localhost/bootc:latest
16+
bootc_tar=examples/bootc.tar
17+
18+
if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
19+
echo "Running before first reboot"
20+
pwd
21+
ls -l
22+
[ -f "${bootc_tar}" ]
23+
podman load -q -i "${bootc_tar}"
24+
podman image exists ${bootc_img}
25+
# Run bootc install
26+
podman run --rm --privileged -v /dev:/dev -v /var/lib/containers:/var/lib/containers -v /:/target \
27+
--pid=host --security-opt label=type:unconfined_t \
28+
${bootc_img} \
29+
env BOOTC_BOOTLOADER_DEBUG=1 bootc install to-existing-root \
30+
--skip-fetch-check \
31+
--acknowledge-destructive \
32+
--root-ssh-authorized-keys /target/root/.ssh/authorized_keys.d/ignition \
33+
--karg=console=ttyS0,115200n8
34+
35+
image=$(bootc status --json |jq -r ".status.otherDeployments[0].image.image.image")
36+
[ ${image} == ${bootc_img} ]
37+
38+
tmt-reboot -c "systemctl reboot"
39+
elif [ "$TMT_REBOOT_COUNT" -eq 1 ]; then
40+
echo 'After the reboot'
41+
bootc status
42+
fi
43+
44+
echo "Run bootc install on existing ostree successfully"

tmt/tests/install.fmf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/test-bootc-install-on-ostree:
2+
summary: Test bootc install on ostree
3+
duration: 30m
4+
adjust:
5+
- when: running_env != existing-ostree
6+
enabled: false
7+
because: this needs to start an ostree OS firstly
8+
test: bash examples/test-on-ostree/test-install-on-ostree.sh

0 commit comments

Comments
 (0)