Read the homes in one order, so their test does not depend on a map's
The homes come from a map of the user database, and the test compared them in the order it happened to iterate: it failed one run in four, the repo check of 2026-10-09 among them.
This commit is contained in:
@@ -42,6 +42,8 @@ var homes = func() []string {
|
||||
for home := range accountsOfHomes() {
|
||||
out = append(out, home)
|
||||
}
|
||||
// In one order: the user database is read into a map, and a map's order is not one.
|
||||
sort.Strings(out)
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ func TestHomesAreAPersonsOrAnAgentsNotAServicesOrRoots(t *testing.T) {
|
||||
passwdFile = passwd
|
||||
t.Cleanup(func() { passwdFile = was })
|
||||
got := strings.Join(homes(), ",")
|
||||
if got != "/home/operator,/home/agent,/home/svc" {
|
||||
if got != "/home/agent,/home/operator,/home/svc" {
|
||||
t.Fatalf("homes %s", got)
|
||||
}
|
||||
if homeAbove("/home/agent/.claude") != "/home/agent" || homeAbove("/home/agent") != "" ||
|
||||
|
||||
Reference in New Issue
Block a user