MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / TestReadMultiConfig

Function TestReadMultiConfig

pkg/config/files_test.go:72–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestReadMultiConfig(t *testing.T) {
73 t.Parallel()
74 a := assertions.New(t)
75
76 _, filename, _, _ := runtime.Caller(0)
77
78 first := path.Join(filepath.Dir(filename), "first.yml")
79 second := path.Join(filepath.Dir(filename), "second.yml")
80 _ = second
81
82 defaults := &multiFileConfig{}
83
84 mgr := InitializeWithDefaults("empty", "empty", defaults)
85 a.So(mgr, should.NotBeNil)
86
87 err := mgr.Parse("--config", first, "--config", second)
88 a.So(err, should.BeNil)
89
90 err = mgr.ReadInConfig()
91 a.So(err, should.BeNil)
92
93 res := new(multiFileConfig)
94 err = mgr.Unmarshal(res)
95 a.So(err, should.BeNil)
96
97 a.So(res.Foo, should.Resemble, "10")
98 a.So(res.Bar, should.Resemble, map[string]string{
99 "a": "baz",
100 "b": "quu",
101 "c": "yo!",
102 })
103}

Callers

nothing calls this directly

Calls 8

InitializeWithDefaultsFunction · 0.85
DirMethod · 0.80
ReadInConfigMethod · 0.80
NewMethod · 0.65
CallerMethod · 0.65
JoinMethod · 0.65
ParseMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected