Explain active Domain maintenance contention
This commit is contained in:
parent
d38357a65d
commit
b288e77ed0
1 changed files with 38 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
use std::fs;
|
||||
|
||||
use lazaret_linux::filesystem::try_exclusive_flock;
|
||||
|
||||
#[allow(clippy::disallowed_methods, clippy::disallowed_types)]
|
||||
#[test]
|
||||
fn machine_and_human_discovery_are_versioned_and_content_free() {
|
||||
|
|
@ -42,6 +44,35 @@ fn reset_refuses_an_arbitrary_container_or_host_path_before_state_access() {
|
|||
);
|
||||
}
|
||||
|
||||
#[allow(clippy::disallowed_methods, clippy::disallowed_types)]
|
||||
#[test]
|
||||
fn active_domain_reports_actionable_maintenance_contention() {
|
||||
let fixture = Fixture::new();
|
||||
assert!(fixture.command("list").output().unwrap().status.success());
|
||||
let lock = try_exclusive_flock(
|
||||
fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(fixture.domain_root().join("domain.lock"))
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let active = fixture.command("verify").output().unwrap();
|
||||
assert!(!active.status.success());
|
||||
assert!(String::from_utf8_lossy(&active.stderr).contains(
|
||||
"Domain state is busy; exit active Lazaret sessions or wait for another maintenance command to finish, then retry"
|
||||
));
|
||||
|
||||
drop(lock);
|
||||
let inactive = fixture.command("verify").output().unwrap();
|
||||
assert!(
|
||||
inactive.status.success(),
|
||||
"{}",
|
||||
String::from_utf8_lossy(&inactive.stderr)
|
||||
);
|
||||
}
|
||||
|
||||
#[allow(clippy::disallowed_methods, clippy::disallowed_types)]
|
||||
#[test]
|
||||
fn missing_store_succeeds_only_when_the_complete_state_anchor_is_absent() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue