fix: do not report collected systemd jobs as failed
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -194,7 +194,7 @@ impl BootState {
|
|||||||
};
|
};
|
||||||
let outcome = match result {
|
let outcome = match result {
|
||||||
JobResult::Done => Outcome::Succeeded { at },
|
JobResult::Done => Outcome::Succeeded { at },
|
||||||
JobResult::Skipped | JobResult::Canceled => Outcome::Abandoned,
|
JobResult::Skipped | JobResult::Canceled | JobResult::Collected => Outcome::Abandoned,
|
||||||
JobResult::Failed => Outcome::Failed(FailureKind::Broke),
|
JobResult::Failed => Outcome::Failed(FailureKind::Broke),
|
||||||
JobResult::Timeout => Outcome::Failed(FailureKind::TimedOut),
|
JobResult::Timeout => Outcome::Failed(FailureKind::TimedOut),
|
||||||
JobResult::Dependency => Outcome::Failed(FailureKind::DependencyFailed),
|
JobResult::Dependency => Outcome::Failed(FailureKind::DependencyFailed),
|
||||||
@@ -337,6 +337,20 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_collected_job_on_a_multi_device_mount_source_is_not_a_failure() {
|
||||||
|
let mut state = BootState::new(Phase::Initrd);
|
||||||
|
queue_unit(
|
||||||
|
&mut state,
|
||||||
|
1,
|
||||||
|
waiting("dev-nvme0n1p1:-dev-nvme1n1p3.device", &[]),
|
||||||
|
500 * MS,
|
||||||
|
);
|
||||||
|
state.finish_job(1, JobResult::Collected, 2000 * MS);
|
||||||
|
assert!(state.failed.is_empty());
|
||||||
|
assert_eq!(state.tally().failed, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_unit_entering_the_failed_state_counts_without_a_failed_job() {
|
fn a_unit_entering_the_failed_state_counts_without_a_failed_job() {
|
||||||
let mut state = sample();
|
let mut state = sample();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ pub enum JobResult {
|
|||||||
Done,
|
Done,
|
||||||
Skipped,
|
Skipped,
|
||||||
Canceled,
|
Canceled,
|
||||||
|
Collected,
|
||||||
Timeout,
|
Timeout,
|
||||||
Dependency,
|
Dependency,
|
||||||
#[serde(other)]
|
#[serde(other)]
|
||||||
@@ -162,6 +163,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_eq!(from_str("maintenance").ok(), Some(ActiveState::Inactive));
|
assert_eq!(from_str("maintenance").ok(), Some(ActiveState::Inactive));
|
||||||
assert_eq!(from_str("dependency").ok(), Some(JobResult::Dependency));
|
assert_eq!(from_str("dependency").ok(), Some(JobResult::Dependency));
|
||||||
|
assert_eq!(from_str("collected").ok(), Some(JobResult::Collected));
|
||||||
assert_eq!(from_str("frozen").ok(), Some(JobResult::Failed));
|
assert_eq!(from_str("frozen").ok(), Some(JobResult::Failed));
|
||||||
assert_eq!(from_str("stop").ok(), Some(JobKind::TakesDown));
|
assert_eq!(from_str("stop").ok(), Some(JobKind::TakesDown));
|
||||||
assert_eq!(from_str("restart").ok(), Some(JobKind::BringsUp));
|
assert_eq!(from_str("restart").ok(), Some(JobKind::BringsUp));
|
||||||
|
|||||||
Reference in new issue
Block a user