Skip to content

Commit 2162466

Browse files
committed
chore(tests): implement /usr overlay tests
Signed-off-by: Robert Sturla <[email protected]>
1 parent 0e04f5a commit 2162466

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

lib/src/fixtures/spec-staged-booted-usrunlock.yaml renamed to lib/src/fixtures/spec-booted-usroverlay.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@ spec:
99
signature: insecure
1010
usrOverlay: readWrite
1111
status:
12-
staged:
13-
image:
14-
image:
15-
image: quay.io/example/someimage:latest
16-
transport: registry
17-
signature: insecure
18-
architecture: arm64
19-
version: nightly
20-
# This one has nanoseconds, which should be dropped for human consumption
21-
timestamp: 2023-10-14T19:22:15.42Z
22-
imageDigest: sha256:16dc2b6256b4ff0d2ec18d2dbfb06d117904010c8cf9732cdb022818cf7a7566
23-
incompatible: false
24-
pinned: false
25-
ostree:
26-
checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d
27-
deploySerial: 0
2812
booted:
2913
image:
3014
image:
@@ -42,3 +26,4 @@ status:
4226
deploySerial: 0
4327
rollback: null
4428
isContainer: false
29+
usrOverlay: readWrite

lib/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub(crate) mod kargs;
1818
mod lints;
1919
mod lsm;
2020
pub(crate) mod metadata;
21+
mod overlay;
2122
mod podman;
2223
mod progress_jsonl;
2324
mod reboot;
@@ -27,7 +28,6 @@ mod status;
2728
mod store;
2829
mod task;
2930
mod utils;
30-
mod overlay;
3131

3232
#[cfg(feature = "docgen")]
3333
mod docgen;

lib/src/status.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ fn human_render_imagestatus(
421421
// Only show the usr filesystem overlay state if we are booted and not the default
422422
// read-only mode.
423423
if slot == Slot::Booted && *usr_overlay != FilesystemOverlay::Readonly {
424-
write_row_name(&mut out, "Usr overlay", prefix_len)?;
424+
write_row_name(&mut out, "/usr overlay", prefix_len)?;
425425
writeln!(out, "{}", usr_overlay.to_human_string())?;
426426
}
427427
}
@@ -450,7 +450,7 @@ fn human_render_ostree(
450450
// Only show the usr filesystem overlay state if we are booted and not the default
451451
// read-only mode.
452452
if slot == Slot::Booted && *usr_overlay != FilesystemOverlay::Readonly {
453-
write_row_name(&mut out, "Usr overlay", prefix_len)?;
453+
write_row_name(&mut out, "/usr overlay", prefix_len)?;
454454
writeln!(out, "{}", usr_overlay.to_human_string())?;
455455
}
456456
}
@@ -612,4 +612,18 @@ mod tests {
612612
Some(ImageSignature::OstreeRemote("fedora".into()))
613613
);
614614
}
615+
616+
#[test]
617+
fn test_human_readable_booted_usroverlay() {
618+
let w =
619+
human_status_from_spec_fixture(include_str!("fixtures/spec-booted-usroverlay.yaml"))
620+
.unwrap();
621+
let expected = indoc::indoc! { r"
622+
● Booted image: quay.io/example/someimage:latest
623+
Digest: sha256:736b359467c9437c1ac915acaae952aad854e07eb4a16a94999a48af08c83c34 (arm64)
624+
Version: nightly (2023-09-30T19:22:16Z)
625+
/usr overlay: read-write
626+
"};
627+
similar_asserts::assert_eq!(w, expected);
628+
}
615629
}

0 commit comments

Comments
 (0)