tests: Add a sanity check for composefs

Prep for adding some coverage of this flow when booting with
composefs.
This commit is contained in:
Colin Walters 2023-06-19 19:02:20 -04:00
parent dd47090e2f
commit 3c7e256cee
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,31 @@
use anyhow::Result;
use xshell::cmd;
pub(crate) fn itest_composefs() -> Result<()> {
let sh = xshell::Shell::new()?;
if !cmd!(sh, "ostree --version").read()?.contains("- composefs") {
println!("SKIP no composefs support");
return Ok(());
}
let mark = match crate::test::get_reboot_mark()? {
None => {
cmd!(
sh,
"ostree --repo=/ostree/repo config set ex-integrity.composefs true"
)
.run()?;
// A dummy change; TODO add an ostree command for this
cmd!(sh, "rpm-ostree kargs --append=foo=bar").run()?;
return Err(crate::test::reboot("1").into());
}
Some(v) => v,
};
if mark != "1" {
anyhow::bail!("Invalid reboot mark: {mark}")
}
let fstype = cmd!(sh, "findmnt -n -o FSTYPE /").read()?;
assert_eq!(fstype.as_str(), "overlay");
Ok(())
}

View File

@ -2,6 +2,7 @@ use anyhow::{bail, Result};
use libtest_mimic::Trial;
use structopt::StructOpt;
mod composefs;
mod destructive;
mod repobin;
mod sysroot;
@ -28,7 +29,10 @@ const TESTS: &[StaticTest] = &[
test!(repobin::itest_extensions),
test!(repobin::itest_pull_basicauth),
];
const DESTRUCTIVE_TESTS: &[StaticTest] = &[test!(destructive::itest_transactionality)];
const DESTRUCTIVE_TESTS: &[StaticTest] = &[
test!(destructive::itest_transactionality),
test!(composefs::itest_composefs),
];
#[derive(Debug, StructOpt)]
#[structopt(rename_all = "kebab-case")]