Skip to content

Commit db55ae7

Browse files
tests/integration: Update composefs booted status test
Check for verity inside the json returned by `bootc status --json` and compare it with the compsefs digest from kernel cmdline Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 31c1ae4 commit db55ae7

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tests-integration/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ serde = { workspace = true, features = ["derive"] }
2323
serde_json = { workspace = true }
2424
tempfile = { workspace = true }
2525
xshell = { workspace = true }
26+
bootc-kernel-cmdline = { path = "../kernel_cmdline", version = "0.0.0" }
2627

2728
# Crate-specific dependencies
2829
libtest-mimic = "0.8.0"

crates/tests-integration/src/composefs_bcvk.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use anyhow::Result;
2+
use bootc_kernel_cmdline;
23
use camino::Utf8Path;
34
use libtest_mimic::Trial;
45
use xshell::{cmd, Shell};
@@ -57,6 +58,28 @@ fn inner_tests() -> Vec<Trial> {
5758
assert!(st.is_object());
5859
assert!(Utf8Path::new("/sysroot/composefs").try_exists()?);
5960
assert!(!Utf8Path::new("/sysroot/ostree").try_exists()?);
61+
62+
let cmdline = bootc_kernel_cmdline::utf8::Cmdline::from_proc()?;
63+
64+
let cfs = cmdline.find("composefs");
65+
assert!(cfs.is_some());
66+
let cfs = cfs.unwrap();
67+
68+
let verity_from_cmdline = cfs.value();
69+
assert!(verity_from_cmdline.is_some());
70+
let verity_from_cmdline = verity_from_cmdline.unwrap();
71+
72+
let verity_from_status = st
73+
.get("status")
74+
.and_then(|s| s.get("booted"))
75+
.and_then(|b| b.get("composefs"))
76+
.and_then(|c| c.get("verity"))
77+
.and_then(|v| v.as_str());
78+
79+
assert!(verity_from_status.is_some());
80+
81+
assert_eq!(verity_from_status.unwrap(), verity_from_cmdline);
82+
6083
Ok(())
6184
})]
6285
.into_iter()

0 commit comments

Comments
 (0)