Lines
100 %
Functions
Branches
use super::{DEGRADED, HEALTHY, UNUSABLE, report_outcome, verdict};
use server::db::DBError;
use server::fleet::FleetReport;
use sqlx::types::Uuid;
fn degraded(report: FleetReport) -> Result<FleetReport, DBError> {
Ok(report)
}
#[test]
fn a_fully_verified_fleet_exits_zero() {
let outcome = degraded(FleetReport {
migrated: 12,
..FleetReport::default()
});
assert_eq!(verdict(&outcome), HEALTHY);
report_outcome(&outcome);
fn an_empty_fleet_exits_zero() {
// The state Release 1 ships in: nothing to migrate is success, not a fault.
assert_eq!(verdict(°raded(FleetReport::default())), HEALTHY);
fn a_quarantined_tenant_degrades_the_run() {
migrated: 3,
quarantined: vec![(Uuid::nil(), "unreachable".to_owned())],
assert_eq!(verdict(&outcome), DEGRADED);
fn a_tenant_this_run_never_verified_degrades_it_too() {
// Another worker held the claim to the end. It may since have died, and a
// zero here would gate a rollout on a database nobody looked at.
unresolved: vec![Uuid::nil()],
fn a_verdict_that_could_not_be_written_degrades_it() {
// The dangerous case: the tenant failed, its quarantine did not stick, and
// it is still being served.
migrated: 5,
unpublished: vec![(Uuid::nil(), "directory unreachable".to_owned())],
fn a_run_that_could_not_happen_is_distinct_from_a_degraded_one() {
let outcome = Err(DBError::MissingUrl);
assert_eq!(
verdict(&outcome),
UNUSABLE,
"an unusable run must be distinguishable from one that ran and found problems"
);