use super::*;
#[test]
fn every_resource_type_appears_in_all_types() {
let listed: Vec<String> = ALL_TYPES.iter().map(ToString::to_string).collect();
for name in [
"package",
"file",
"service",
"mount",
"user",
"docker",
"pepita",
"network",
"cron",
"recipe",
"model",
"gpu",
"task",
"wasm_bundle",
"image",
"build",
"github_release",
"overlay_interface",
"disk_budget",
"backup_sync",
] {
assert!(
listed.iter().any(|l| l == name),
"resource type `{name}` is missing from ALL_TYPES, so it is never dogfooded"
);
}
assert_eq!(
listed.len(),
21,
"ALL_TYPES has {} entries; update this test when a type is added",
listed.len()
);
}
#[test]
fn no_type_is_silently_uncovered() {
for t in ALL_TYPES {
match coverage(t) {
Coverage::Exercised => {}
Coverage::NotApplicable(why) => assert!(
!why.trim().is_empty(),
"{t} is NotApplicable with no reason — state the debt or exercise it"
),
}
}
}
#[test]
fn the_resources_that_shipped_broken_are_exercised() {
for t in [ResourceType::DiskBudget, ResourceType::BackupSync] {
assert_eq!(
coverage(&t),
Coverage::Exercised,
"{t} must stay exercised — it shipped broken precisely because it was not"
);
}
}
#[test]
fn exercised_types_all_have_a_real_exercise() {
for t in ALL_TYPES {
if coverage(t) != Coverage::Exercised {
continue;
}
let o = exercises::run_for(t);
assert!(
!o.detail.contains("has no exercise"),
"{t} is declared Exercised but has no exercise implemented"
);
}
}
#[test]
fn not_applicable_debt_is_reportable() {
let debt = not_applicable();
assert!(
!debt.is_empty(),
"some types are legitimately host-mutating"
);
for (name, why) in &debt {
assert!(!name.is_empty());
assert!(!why.is_empty(), "{name} carries an empty reason");
}
}
#[test]
fn disk_budget_exercise_detects_both_real_cargo_layouts() {
let o = exercises::run_for(&ResourceType::DiskBudget);
assert!(
o.passed,
"disk_budget dogfood exercise failed: {}",
o.detail
);
assert!(o.detail.contains("4 real shapes"), "{}", o.detail);
}