| 13 | } |
| 14 | |
| 15 | func 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. |
| 36 | func TestNewMulti(t *testing.T) { |