[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:
@@ -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