config: add test case for scrape interval larger than timeout. (#6037)

Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
johncming 2019-09-23 19:26:56 +08:00 committed by Simon Pasquier
parent 31a8ac3219
commit 8d3083e256
2 changed files with 25 additions and 0 deletions

View File

@ -664,6 +664,15 @@ func TestLoadConfig(t *testing.T) {
testutil.Equals(t, expectedConf, c)
}
func TestScrapeIntervalLarger(t *testing.T) {
c, err := LoadFile("testdata/scrape_interval_larger.good.yml")
testutil.Ok(t, err)
testutil.Equals(t, 1, len(c.ScrapeConfigs))
for _, sc := range c.ScrapeConfigs {
testutil.Equals(t, true, sc.ScrapeInterval >= sc.ScrapeTimeout)
}
}
// YAML marshaling must not reveal authentication credentials.
func TestElideSecrets(t *testing.T) {
c, err := LoadFile("testdata/conf.good.yml")

View File

@ -0,0 +1,16 @@
global:
scrape_interval: 15s
scrape_timeout: 15s
scrape_configs:
- job_name: prometheus
scrape_interval: 5s
dns_sd_configs:
- refresh_interval: 15s
names:
- first.dns.address.domain.com
- second.dns.address.domain.com
- names:
- first.dns.address.domain.com