Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/lib/src/install/aleph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ pub(crate) struct InstallAleph {
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub(crate) labels: BTreeMap<String, String>,
/// The version number
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) version: Option<String>,
/// The timestamp
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) timestamp: Option<chrono::DateTime<chrono::Utc>>,
/// The `uname -r` of the kernel doing the installation
pub(crate) kernel: String,
Expand Down
18 changes: 18 additions & 0 deletions tmt/tests/booted/readonly/013-test-aleph.nu
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ if $is_composefs {
let bootc_label = $labels | get "containers.bootc"
assert ($bootc_label | is-not-empty) "containers.bootc label should be present"
}

# The version field is optional (skip_serializing_if = Option::is_none),
# but if present it should match the booted image's version.
let version = $aleph.version? | default null
if $version != null {
assert ($version | is-not-empty) "version field, if present, should be non-empty"
let booted_version = $booted.image.version
assert equal $version $booted_version "version should match the booted image's version"
}

# The timestamp field may be absent if empty (skip_serializing_if), but if
# present it should match the booted image's timestamp.
let timestamp = $aleph.timestamp? | default null
if $timestamp != null {
assert ($timestamp | is-not-empty) "timestamp field, if present, should be non-empty"
let booted_timestamp = $booted.image.timestamp
assert equal $timestamp $booted_timestamp "timestamp should match the booted image's timestamp"
}
}

tap ok
Loading