From 7adadf756dfe19c034758e4da1509ea3afe40750 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 20 Oct 2026 22:09:59 +0200 Subject: [PATCH] Test that a config module with no settings row is read from mesh-config (issue 1493) --- ...compose_input_settings_integration_test.go | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 cmd/mesh-controller/compose_input_settings_integration_test.go diff --git a/cmd/mesh-controller/compose_input_settings_integration_test.go b/cmd/mesh-controller/compose_input_settings_integration_test.go new file mode 100644 index 00000000..9e547627 --- /dev/null +++ b/cmd/mesh-controller/compose_input_settings_integration_test.go @@ -0,0 +1,45 @@ +//go:build integration + +package main + +import ( + "context" + "testing" +) + +// Issue 1493: a module in the config form whose value is set only in mesh-config, with no settings row, reaches the +// node's settings in the composition's input. +func TestAConfigModuleWithoutASettingsRowIsReadFromConfig(t *testing.T) { + open := aMesh(t) + ctx := t.Context() + inv := open.inventory + register(t, open, configForm(t, "brother")) + if _, err := assign(ctx, open, "anchor", "brother"); err != nil { + t.Fatal(err) + } + inv.ExecForTest(t, `insert into config_move (moved_by, why) values ('a test', 'issue 1493')`) + inv.ReadsConfigFrom(func(_ context.Context, node, module string) (map[string]any, error) { + if node == "anchor" && module == "brother" { + return map[string]any{"level": "debug"}, nil + } + return nil, nil + }) + in, _, err := readMeshAndNodes(ctx, open) + if err != nil { + t.Fatal(err) + } + if _, err := readSettings(ctx, open, &in); err != nil { + t.Fatal(err) + } + for _, n := range in.Nodes { + if n.Name != "anchor" { + continue + } + layers := n.Settings["brother"] + if len(layers) != 1 || layers[0].Values["level"] != "debug" { + t.Fatalf("anchor's settings for brother are %+v, want level debug from mesh-config", layers) + } + return + } + t.Fatal("no anchor node in the input") +}