MCPcopy
hub / github.com/grafana/dskit / TestMultiRuntimeConfigWithVariousEnabledValues

Function TestMultiRuntimeConfigWithVariousEnabledValues

kv/multi_test.go:15–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13}
14
15func TestMultiRuntimeConfigWithVariousEnabledValues(t *testing.T) {
16 testcases := map[string]struct {
17 yaml string
18 expected *bool
19 }{
20 "nil": {"primary: test", nil},
21 "true": {"primary: test\nmirror_enabled: true", boolPtr(true)},
22 "false": {"mirror_enabled: false", boolPtr(false)},
23 }
24
25 for name, tc := range testcases {
26 t.Run(name, func(t *testing.T) {
27 c := MultiRuntimeConfig{}
28 err := yaml.Unmarshal([]byte(tc.yaml), &c)
29 assert.NoError(t, err, tc.yaml)
30 assert.Equal(t, tc.expected, c.Mirroring, tc.yaml)
31 })
32 }
33}
34
35// This simple test could reproduce panic in watchConfigChannel goroutine, if metrics didn't exist yet.
36func TestNewMulti(t *testing.T) {

Callers

nothing calls this directly

Calls 4

boolPtrFunction · 0.85
RunMethod · 0.80
UnmarshalMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected