From 8dc186944e7d7cd33911b1730e2845cf7cd67dd1 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 18:10:28 +0100 Subject: [PATCH] fix-1748-host-test: the own resolver's test reads the options from the catalogue's template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestTheCataloguesResolverComposesOnAMachine takes the options line from the systemd-resolved template beside it instead of the literal timeout:1 attempts:2 edns0, so it passes against the catalogue's main before and after the catalogue's change. Captured copies are left as they are. Builds: design 50 resolver-wait §3 (and §2 of the main file, line 73) --- internal/compose/resolution/node_resolver_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/compose/resolution/node_resolver_test.go b/internal/compose/resolution/node_resolver_test.go index 40338312..363b1fb1 100644 --- a/internal/compose/resolution/node_resolver_test.go +++ b/internal/compose/resolution/node_resolver_test.go @@ -151,6 +151,16 @@ func TestTheCataloguesResolverHoldersWriteTheFileAndProvideSplitDNS(t *testing.T func TestTheCataloguesResolverComposesOnAMachine(t *testing.T) { shelf := resolverShelf(t) shelf["systemd-resolved"] = catalogueManifest(t, "systemd-resolved") + // The options line is the catalogue's own template's, never a literal of it here (design 50 resolver-wait §3). + options := "" + for _, l := range strings.Split(shelf["systemd-resolved"].Facts["resolvers"].Template, "\n") { + if strings.HasPrefix(l, "options ") { + options = l + } + } + if options == "" { + t.Fatal("the catalogue's resolver template has no options line") + } got, err := Resolve(shelf, []string{"dnsmasq", "systemd-networkd", "systemd-resolved"}, splitDNSLaptop(), mcat.World{}) if err != nil { t.Fatal(err) @@ -166,7 +176,7 @@ func TestTheCataloguesResolverComposesOnAMachine(t *testing.T) { ids := byID(out) resolv, _ := ids["systemd-resolved.fact-resolvers"]["content"].(string) kept, _ := ids["systemd-resolved.fact-kept"]["content"].(string) - if !strings.Contains(resolv, "\nnameserver 10.42.0.2\noptions timeout:1 attempts:2 edns0\n") || resolv != kept { + if !strings.Contains(resolv, "\nnameserver 10.42.0.2\n"+options+"\n") || resolv != kept { t.Errorf("the resolver file does not name this machine's own resolver alone, or its copy differs:\n%s", resolv) } if ids["systemd-networkd.fact-resolvers"] != nil {