Files
mesh-host/internal/apply/root_moved_test.go
T
jochen a7270f00cb
mesh/merge-gate pass: builds mesh-host → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group fix/361-the-setuid-search-runs-to-completion delivered: every member is delivered
Keep the walk's paths as bytes, forget a walk root superseded, and leave other mounts unread (hq issue 361 review)
The review found a cursor of a name that is not UTF-8 came back changed
from JSON, so a resumed walk skipped what it stood before; an ask to
search again was lost to a restart, which carried the older walk on; a
fresh search judged a filesystem it never walked; a mount point root
cannot read failed or hung the walk; a found file gone before the package
manager was asked failed every resume; and skipped or kept outcomes
started a search on every reconcile, back to back with a long walk.
2026-10-10 01:10:56 +02:00

33 lines
1.5 KiB
Go

package apply
import "testing"
// An apply that moved what root controls asks for a new search for setuid programs (novox/hq issue 361); one
// that moved nothing of it does not.
func TestAnApplyMovesRootThroughAnAccountAPackageAnActionOrSudosRules(t *testing.T) {
for _, c := range []struct {
o Outcome
want bool
}{
{Outcome{Type: "user", Target: "nox", Action: "created"}, true},
{Outcome{Type: "user", Target: "nox", Action: "unchanged"}, false},
{Outcome{Type: "package", Target: "telegram", Action: "created"}, true},
{Outcome{Type: "package", Target: "telegram", Action: "removed"}, true},
{Outcome{Type: "action", Target: "setup", Action: "updated"}, true},
{Outcome{Type: "file", Target: "/etc/sudoers.d/mesh", Action: "updated"}, true},
{Outcome{Type: "file", Target: "/etc/group", Action: "corrected"}, true},
{Outcome{Type: "directory", Target: "/etc/polkit-1/rules.d", Action: "created"}, true},
{Outcome{Type: "file", Target: "/etc/sudoers.dx", Action: "updated"}, false},
{Outcome{Type: "file", Target: "/etc/nginx/nginx.conf", Action: "updated"}, false},
{Outcome{Type: "container", Target: "plex", Action: "updated"}, false},
{Outcome{Type: "package", Target: "x", Action: heldStill}, false},
{Outcome{Type: "action", Target: "setup", Action: "skipped"}, false},
{Outcome{Type: "user", Target: "nox", Action: "forgotten"}, false},
{Outcome{Type: "package", Target: "x", Action: "kept"}, false},
} {
if got := MovesRoot([]Outcome{c.o}); got != c.want {
t.Errorf("%+v: moves root %v, want %v", c.o, got, c.want)
}
}
}