[roads] QA F-07: a missing roads/ folder is store.roads, and roads/ is never followed through a link
A store folder without roads/ compiled to plans with no access and no problem, kill switches included. It is now an error naming roads. A roads/ that is a file or a symbolic link is refused the same way (the builder's self-review #8): entries inside were already refused, the folder itself was followed.
This commit is contained in:
@@ -200,7 +200,6 @@ fn f06_a_road_across_address_families_is_reported() {
|
||||
/// F-07. A store folder without `roads/` compiles to plans with no access and no problem at all, so pointing
|
||||
/// `--store` one folder too high revokes everything, kill switches included, without a word.
|
||||
#[test]
|
||||
#[ignore = "QA F-07 (minor): a missing roads/ folder is not reported"]
|
||||
fn f07_a_missing_roads_folder_is_reported() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
std::fs::copy(
|
||||
|
||||
@@ -207,6 +207,25 @@ fn generated(baseline: &[u8]) -> BTreeSet<String> {
|
||||
.any(|p| p.path == "directory.json" && p.code == rules::SNAPSHOT_JSON)
|
||||
);
|
||||
assert!(c.plans.is_empty());
|
||||
// store.roads: a store folder without roads/, and one whose roads/ is a file (QA F-07).
|
||||
for make_roads in [false, true] {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
for f in ["directory.json", "devices.json"] {
|
||||
std::fs::copy(common::home_dir().join(f), tmp.path().join(f)).unwrap();
|
||||
}
|
||||
if make_roads {
|
||||
std::fs::write(tmp.path().join("roads"), "not a folder").unwrap();
|
||||
}
|
||||
let s = Store::load_dir(tmp.path()).unwrap();
|
||||
assert!(
|
||||
s.problems
|
||||
.iter()
|
||||
.any(|p| p.path == "roads" && p.code == rules::STORE_ROADS && p.is_error()),
|
||||
"{:?}",
|
||||
s.problems
|
||||
);
|
||||
}
|
||||
hit.insert(rules::STORE_ROADS.into());
|
||||
hit
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user