MCPcopy
hub / github.com/grafana/tempo / TestConfig

Function TestConfig

modules/generator/storage/config_test.go:15–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestConfig(t *testing.T) {
16 cfgStr := `
17path: /var/wal/tempo
18wal:
19 wal_compression: "snappy"
20remote_write_flush_deadline: 5m
21remote_write:
22 - url: http://prometheus/api/prom/push
23 headers:
24 foo: bar
25`
26
27 var cfg Config
28 cfg.RegisterFlagsAndApplyDefaults("", nil)
29
30 err := yaml.UnmarshalStrict([]byte(cfgStr), &cfg)
31 assert.NoError(t, err)
32
33 walCfg := agentDefaultOptions()
34 walCfg.WALCompression = compression.Snappy
35
36 remoteWriteConfig := prometheus_config.DefaultRemoteWriteConfig
37 prometheusURL, err := url.Parse("http://prometheus/api/prom/push")
38 assert.NoError(t, err)
39 remoteWriteConfig.URL = &prometheus_common_config.URL{URL: prometheusURL}
40 remoteWriteConfig.Headers = map[string]string{
41 "foo": "bar",
42 }
43
44 expectedCfg := Config{
45 Path: "/var/wal/tempo",
46 Wal: walCfg,
47 RemoteWriteFlushDeadline: 5 * time.Minute,
48 RemoteWriteAddOrgIDHeader: true,
49 RemoteWrite: []prometheus_config.RemoteWriteConfig{
50 remoteWriteConfig,
51 },
52 }
53 assert.Equal(t, expectedCfg, cfg)
54}

Callers

nothing calls this directly

Calls 4

agentDefaultOptionsFunction · 0.85
ParseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected