From 1c61b72f354d9f2ebbb3f5b85522d74c670dd3a1 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 9 Oct 2026 12:36:56 +0200 Subject: [PATCH] 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. --- internal/apply/home_links.go | 2 ++ internal/apply/home_links_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/apply/home_links.go b/internal/apply/home_links.go index 7c359c9..414076c 100644 --- a/internal/apply/home_links.go +++ b/internal/apply/home_links.go @@ -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 } diff --git a/internal/apply/home_links_test.go b/internal/apply/home_links_test.go index 041500b..97a47e3 100644 --- a/internal/apply/home_links_test.go +++ b/internal/apply/home_links_test.go @@ -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") != "" ||