[roads] QA B-3: an app road names whose devices it is for, and reaches only those
subject: app:<id> applied to every device in the mesh, so whoever could write one road (app:steam goes-direct 0.0.0.0/0) changed the tunnel of other people's devices, an exit and a classic router. An app road now needs the new header key on: (a person, group or device), and reaches only those devices; on: is forbidden on any other subject. The home fixture's steam road is on Mark's devices, so it leaves Jana's, Petr's and the router's plans. Four fixtures, a B-3 test (fails if app roads reach every device again), the property generator scopes app roads to a person, and the R-55 renaming rewrites on: like subject:.
This commit is contained in:
@@ -364,3 +364,29 @@ fn f09_an_emptied_narrowing_condition_is_an_error() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// B-3. An `app:` road used to reach every device in the mesh, other people's included: `app:steam goes-direct
|
||||
/// 0.0.0.0/0` changed the tunnel of Jana's phone, Petr's friend node and a classic router. An app road now names
|
||||
/// whose devices it is for (`on:`), and reaches only those.
|
||||
#[test]
|
||||
fn b3_an_app_road_reaches_only_the_devices_it_is_on() {
|
||||
let c = Parts::home().compile();
|
||||
let steam = |k: u8| c.plans[&key(k)].direct.iter().any(|d| d.app.is_some());
|
||||
assert!(steam(2), "mark's home server runs the road");
|
||||
for (k, who) in [
|
||||
(3, "jana-phone"),
|
||||
(4, "jana-laptop"),
|
||||
(5, "router"),
|
||||
(6, "friend-node"),
|
||||
(7, "petr-phone"),
|
||||
] {
|
||||
assert!(!steam(k), "{who} is not mark's, and its tunnel changed");
|
||||
}
|
||||
// The same road for Jana moves to Jana's devices.
|
||||
let text = Parts::home()
|
||||
.road_text("e5yj1s")
|
||||
.replace("on: person:mark", "on: person:jana");
|
||||
let c = Parts::home().replace_road("e5yj1s", &text).compile();
|
||||
let steam = |k: u8| c.plans[&key(k)].direct.iter().any(|d| d.app.is_some());
|
||||
assert!(steam(3) && steam(4) && !steam(2) && !steam(6));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user