Test that a config module with no settings row is read from mesh-config (issue 1493)
mesh/merge-gate head 7adadf756dfe merged into trunk 073ccc29c603 — pass: builds mesh-controller → novox; no bus step; every machine composes with the chang…
mesh/repo-check head 7adadf756dfe merged into trunk 073ccc29c603 — pass: its merge-check.sh passed
mesh/delivery delivered
mesh/merge-gate head 7adadf756dfe merged into trunk 073ccc29c603 — pass: builds mesh-controller → novox; no bus step; every machine composes with the chang…
mesh/repo-check head 7adadf756dfe merged into trunk 073ccc29c603 — pass: its merge-check.sh passed
mesh/delivery delivered
This commit is contained in:
@@ -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")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user