(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestConfig(t *testing.T) { |
| 16 | cfgStr := ` |
| 17 | path: /var/wal/tempo |
| 18 | wal: |
| 19 | wal_compression: "snappy" |
| 20 | remote_write_flush_deadline: 5m |
| 21 | remote_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 | } |
nothing calls this directly
no test coverage detected