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
10 changes: 6 additions & 4 deletions crates/lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,10 +1336,12 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
}
Opt::Edit(opts) => edit(opts).await,
Opt::UsrOverlay => {
let storage = &get_storage().await?;
match storage.kind()? {
BootedStorageKind::Ostree(_) => usroverlay().await,
BootedStorageKind::Composefs(_) => composefs_usr_overlay(),
use crate::store::Environment;
let env = Environment::detect()?;
match env {
Environment::OstreeBooted => usroverlay().await,
Environment::ComposefsBooted(_) => composefs_usr_overlay(),
_ => anyhow::bail!("usroverlay only applies on booted hosts"),
}
}
Opt::Container(opts) => match opts {
Expand Down
7 changes: 7 additions & 0 deletions tmt/plans/integration.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ execute:
enabled: false
because: tmt-reboot does not work with systemd reboot in testing farm environment (see bug-soft-reboot.md)

/test-23-usroverlay:
summary: Usroverlay
discover:
how: fmf
test:
- /tmt/tests/test-23-usroverlay

/test-28-factory-reset:
summary: Factory reset
discover:
Expand Down
14 changes: 14 additions & 0 deletions tmt/tests/booted/bootc_testlib.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# A simple nushell "library" for the

# This is a workaround for what must be a systemd bug
# that seems to have appeared in C10S
# TODO diagnose and fill in here
export def reboot [] {
# Sometimes systemd daemons are still running old binaries and response "Access denied" when send reboot request
# Force a full sync before reboot
sync
# Allow more delay for bootc to settle
sleep 30sec

tmt-reboot
}
12 changes: 2 additions & 10 deletions tmt/tests/booted/test-factory-reset.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std assert
use tap.nu
use bootc_testlib.nu

def initial_build [] {
tap begin "factory reset test"
Expand Down Expand Up @@ -41,16 +42,7 @@ def initial_build [] {
# nu's cp doesn't have -T
/usr/bin/cp -r -T $workdir_root $"($new_stateroot_path)/($workdir_root)"

# Check reset status before reboot
RUST_LOG=trace bootc status

# Sometimes systemd daemons are still running old binaries and response "Access denied" when send reboot request
# Force a full sync before reboot
sync
# Allow more delay for bootc to settle
sleep 30sec

tmt-reboot
bootc_testlib reboot
}

# The second boot; verify we're in the factory reset deployment
Expand Down
32 changes: 32 additions & 0 deletions tmt/tests/booted/test-usroverlay.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Verify that bootc usroverlay works
use std assert
use tap.nu
use bootc_testlib.nu

bootc status

# We should start out in a non-writable state on each boot
let is_writable = (do -i { /bin/test -w /usr } | complete | get exit_code) == 0
assert (not $is_writable)

def initial_run [] {
bootc usroverlay
let is_writable = (do -i { /bin/test -w /usr } | complete | get exit_code) == 0
assert ($is_writable)

bootc_testlib reboot
}

# The second boot; verify we're in the derived image
def second_boot [] {
# Nothing, we already verified non-writability above
}

def main [] {
# See https://tmt.readthedocs.io/en/stable/stories/features.html#reboot-during-test
match $env.TMT_REBOOT_COUNT? {
null | "0" => initial_run,
"1" => second_boot,
$o => { error make { msg: $"Invalid TMT_REBOOT_COUNT ($o)" } },
}
}
3 changes: 3 additions & 0 deletions tmt/tests/test-23-usroverlay.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: Execute tests for bootc usrover
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the summary. It should be usroverlay.

summary: Execute tests for bootc usroverlay

test: nu booted/test-usroverlay.nu
duration: 30m