review: hold the hosts region through composition, and say so in plan
A declaration-level test composes the shipped networking module with a resolver and asserts /etc/hosts arrives as mesh-wireguard.fact-node-names with into: block and region-only content, that the resolver's restart-on still names it, and that a resource's at passes through untouched — a composition step dropping into would otherwise go unnoticed. plan --show marks files written into, so a region is not read as the whole file. The rollout order is spelled out: every node's host, the controller's own included, must be block-aware before this controller ships (hq 128).
This commit is contained in:
@@ -35,3 +35,17 @@ func TestListensLinesAreEmptyForAModuleWithNothingToListenOn(t *testing.T) {
|
||||
t.Errorf("a module with no listens should print nothing, got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// `plan --show` says when a file is written into rather than over (novox/hq issue 128), or the
|
||||
// mesh's region of a hosts file reads as the whole file.
|
||||
func TestAFileWrittenIntoIsShownAsSuch(t *testing.T) {
|
||||
region := shownAs(map[string]any{
|
||||
"id": "mesh-wireguard.fact-node-names", "path": "/etc/hosts", "into": "block"})
|
||||
if region != "mesh-wireguard.fact-node-names /etc/hosts (written into, block)" {
|
||||
t.Errorf("the region is shown as %q", region)
|
||||
}
|
||||
whole := shownAs(map[string]any{"id": "dnsmasq.fact-node-zones", "path": "/etc/mesh-resolver/nodes.conf"})
|
||||
if strings.Contains(whole, "written into") {
|
||||
t.Errorf("a whole file is shown as written into: %q", whole)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user