Skip to content

Commit dc68b62

Browse files
Add composefs tests
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 7b4f32b commit dc68b62

9 files changed

Lines changed: 50 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
matrix:
155155
# No fedora-44 due to https://bugzilla.redhat.com/show_bug.cgi?id=2429501
156156
test_os: [fedora-42, fedora-43, centos-9, centos-10]
157-
variant: [ostree, composefs-sealeduki-sdboot]
157+
variant: [composefs]
158158
exclude:
159159
# centos-9 UKI is experimental/broken (https://github.com/bootc-dev/bootc/issues/1812)
160160
- test_os: centos-9
@@ -201,6 +201,8 @@ jobs:
201201
- name: Run TMT integration tests
202202
run: |
203203
if [ "${{ matrix.variant }}" = "composefs-sealeduki-sdboot" ]; then
204+
just test-composefs-sealeduki-sdboot
205+
elif [ "${{ matrix.variant }}" = "composefs" ]; then
204206
just test-composefs
205207
else
206208
just test-tmt integration

Justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,13 @@ package:
122122
# Keep localhost/bootc-pkg for layer caching; use `just clean-local-images` to reclaim space
123123

124124
# Build+test using the `composefs-sealeduki-sdboot` variant.
125-
test-composefs:
125+
test-composefs-sealeduki-sdboot:
126126
just variant=composefs-sealeduki-sdboot test-tmt readonly local-upgrade-reboot
127127

128+
test-composefs:
129+
just variant=composefs test-tmt --composefs-backend readonly image-upgrade-reboot \
130+
download-only image-pushpull-upgrade install-outside-container soft-reboot usroverlay
131+
128132
# Only used by ci.yml right now
129133
build-install-test-image: build
130134
cd hack && podman build {{base_buildargs}} -t {{base_img}}-install -f Containerfile.drop-lbis

crates/tests-integration/src/container.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use anyhow::{Context, Result};
88
use camino::Utf8Path;
99
use fn_error_context::context;
1010
use libtest_mimic::Trial;
11-
use xshell::{Shell, cmd};
11+
use xshell::{cmd, Shell};
1212

1313
fn new_test(description: &'static str, f: fn() -> anyhow::Result<()>) -> libtest_mimic::Trial {
1414
Trial::test(description, move || f().map_err(Into::into))
@@ -52,8 +52,8 @@ pub(crate) fn test_bootc_container_inspect() -> Result<()> {
5252
.expect("kernel.unified should be a boolean");
5353
if let Some(variant) = std::env::var("BOOTC_variant").ok() {
5454
match variant.as_str() {
55-
"ostree" => {
56-
assert!(!unified, "Expected unified=false for ostree variant");
55+
v @ "ostree" | v @ "composefs" => {
56+
assert!(!unified, "Expected unified=false for variant {v}");
5757
// For traditional kernels, version should look like a uname (contains digits)
5858
assert!(
5959
version.chars().any(|c| c.is_ascii_digit()),
@@ -146,7 +146,7 @@ fn test_variant_base_crosscheck() -> Result<()> {
146146
"ostree" => {
147147
assert!(!boot_efi.try_exists()?);
148148
}
149-
"composefs-sealeduki-sdboot" => {
149+
"composefs" | "composefs-sealeduki-sdboot" => {
150150
assert!(boot_efi.try_exists()?);
151151
}
152152
o => panic!("Unhandled variant: {o}"),

crates/xtask/src/buildsys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::collections::BTreeMap;
55
use anyhow::{Context, Result};
66
use camino::{Utf8Path, Utf8PathBuf};
77
use fn_error_context::context;
8-
use xshell::{Shell, cmd};
8+
use xshell::{cmd, Shell};
99

1010
const DOCKERFILE_NETWORK_CUTOFF: &str = "external dependency cutoff point";
1111

crates/xtask/src/man.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use camino::Utf8Path;
88
use fn_error_context::context;
99
use serde::{Deserialize, Serialize};
1010
use std::{fs, io::Write};
11-
use xshell::{Shell, cmd};
11+
use xshell::{cmd, Shell};
1212

1313
/// Represents a CLI option extracted from the JSON dump
1414
#[derive(Debug, Serialize, Deserialize)]

crates/xtask/src/tmt.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::{Context, Result};
22
use camino::{Utf8Path, Utf8PathBuf};
33
use fn_error_context::context;
44
use rand::Rng;
5-
use xshell::{Shell, cmd};
5+
use xshell::{cmd, Shell};
66

77
// Generation markers for integration.fmf
88
const PLAN_MARKER_BEGIN: &str = "# BEGIN GENERATED PLANS\n";
@@ -29,6 +29,8 @@ const ENV_BOOTC_UPGRADE_IMAGE: &str = "BOOTC_upgrade_image";
2929
// Distro identifiers
3030
const DISTRO_CENTOS_9: &str = "centos-9";
3131

32+
const COMPOSEFS_KERNEL_ARGS: [&str; 1] = ["--karg=enforcing=0"];
33+
3234
// Import the argument types from xtask.rs
3335
use crate::{RunTmtArgs, TmtProvisionArgs};
3436

@@ -390,6 +392,7 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
390392
println!("\n========================================");
391393
println!("Running plan: {}", plan);
392394
println!("VM name: {}", vm_name);
395+
println!("args: {args:#?}");
393396
println!("========================================\n");
394397

395398
// Reset plan-specific environment variables
@@ -430,6 +433,13 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
430433
opts.push("--filesystem=xfs".to_string());
431434
}
432435
}
436+
437+
if args.composefs_backend {
438+
opts.push("--filesystem=ext4".into());
439+
opts.push("--composefs-backend".into());
440+
opts.extend(COMPOSEFS_KERNEL_ARGS.map(|x| x.into()));
441+
}
442+
433443
opts
434444
};
435445

crates/xtask/src/xtask.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use anyhow::{Context, Result};
1212
use camino::{Utf8Path, Utf8PathBuf};
1313
use clap::{Args, Parser, Subcommand};
1414
use fn_error_context::context;
15-
use xshell::{Shell, cmd};
15+
use xshell::{cmd, Shell};
1616

1717
mod buildsys;
1818
mod man;
@@ -81,6 +81,9 @@ pub(crate) struct RunTmtArgs {
8181
/// Preserve VMs after test completion (useful for debugging)
8282
#[arg(long)]
8383
pub(crate) preserve_vm: bool,
84+
85+
#[arg(long)]
86+
pub(crate) composefs_backend: bool,
8487
}
8588

8689
/// Arguments for tmt-provision command

hack/build-sealed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runv() {
1919
}
2020

2121
case $variant in
22-
ostree)
22+
ostree|composefs)
2323
# Nothing to do
2424
echo "Not building a sealed image; forwarding tag"
2525
runv podman tag $input_image $output_image

tmt/tests/booted/test-image-pushpull-upgrade.nu

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ RUN echo test content > /usr/share/blah.txt
5454
let v = podman run --rm localhost/bootc-derived cat /usr/share/blah.txt | str trim
5555
assert equal $v "test content"
5656

57-
let orig_root_mtime = ls -Dl /ostree/bootc | get modified
57+
mut orig_root_mtime = null;
58+
59+
if not $is_composefs {
60+
$orig_root_mtime = ls -Dl /ostree/bootc | get modified
61+
}
5862

5963
# Now, fetch it back into the bootc storage!
6064
# We also test the progress API here
@@ -68,24 +72,25 @@ RUN echo test content > /usr/share/blah.txt
6872
systemd-run -u test-cat-progress -- /bin/bash -c $"exec cat ($progress_fifo) > ($progress_json)"
6973
# nushell doesn't do fd passing right now either, so run via bash
7074
bash -c $"bootc switch --progress-fd 3 --transport containers-storage localhost/bootc-derived 3>($progress_fifo)"
71-
# Now, let's do some checking of the progress json
72-
let progress = open --raw $progress_json | from json -o
73-
sanity_check_switch_progress_json $progress
7475

75-
# Check that /run/reboot-required exists and is not empty
76-
let rr_meta = (ls /run/reboot-required | first)
77-
assert ($rr_meta.size > 0b)
76+
if not $is_composefs {
77+
# Now, let's do some checking of the progress json
78+
let progress = open --raw $progress_json | from json -o
79+
sanity_check_switch_progress_json $progress
7880

79-
# Verify that we logged to the journal
80-
journalctl _MESSAGE_ID=3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7
81+
# Check that /run/reboot-required exists and is not empty
82+
let rr_meta = (ls /run/reboot-required | first)
83+
assert ($rr_meta.size > 0b)
8184

82-
# The mtime should change on modification
83-
let new_root_mtime = ls -Dl /ostree/bootc | get modified
84-
assert ($new_root_mtime > $orig_root_mtime)
85+
# Verify that we logged to the journal
86+
journalctl _MESSAGE_ID=3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7
8587

86-
# Test for https://github.com/ostreedev/ostree/issues/3544
87-
# Add a quoted karg using rpm-ostree if available
88-
if not $is_composefs {
88+
# The mtime should change on modification
89+
let new_root_mtime = ls -Dl /ostree/bootc | get modified
90+
assert ($new_root_mtime > $orig_root_mtime)
91+
92+
# Test for https://github.com/ostreedev/ostree/issues/3544
93+
# Add a quoted karg using rpm-ostree if available
8994
# Check rpm-ostree and rpm-ostreed service status before run rpm-ostree
9095
# And collect info for flaky error "error: System transaction in progress"
9196
rpm-ostree status

0 commit comments

Comments
 (0)