diff --git a/config/config_test.go b/config/config_test.go index eca06556c..e485653b4 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -30,6 +30,7 @@ import ( "github.com/prometheus/prometheus/discovery/azure" sd_config "github.com/prometheus/prometheus/discovery/config" "github.com/prometheus/prometheus/discovery/consul" + "github.com/prometheus/prometheus/discovery/digitalocean" "github.com/prometheus/prometheus/discovery/dns" "github.com/prometheus/prometheus/discovery/dockerswarm" "github.com/prometheus/prometheus/discovery/ec2" @@ -606,6 +607,28 @@ var expectedConf = &Config{ }, }, }, + { + JobName: "digitalocean-droplets", + + HonorTimestamps: true, + ScrapeInterval: model.Duration(15 * time.Second), + ScrapeTimeout: DefaultGlobalConfig.ScrapeTimeout, + + MetricsPath: DefaultScrapeConfig.MetricsPath, + Scheme: DefaultScrapeConfig.Scheme, + + ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{ + DigitalOceanSDConfigs: []*digitalocean.SDConfig{ + { + HTTPClientConfig: config_util.HTTPClientConfig{ + BearerToken: "abcdef", + }, + Port: 80, + RefreshInterval: model.Duration(60 * time.Second), + }, + }, + }, + }, { JobName: "dockerswarm", @@ -713,7 +736,7 @@ func TestElideSecrets(t *testing.T) { yamlConfig := string(config) matches := secretRe.FindAllStringIndex(yamlConfig, -1) - testutil.Assert(t, len(matches) == 7, "wrong number of secret matches found") + testutil.Assert(t, len(matches) == 8, "wrong number of secret matches found") testutil.Assert(t, !strings.Contains(yamlConfig, "mysecret"), "yaml marshal reveals authentication credentials.") } diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml index 5571666c9..7d0b441ef 100644 --- a/config/testdata/conf.good.yml +++ b/config/testdata/conf.good.yml @@ -259,6 +259,10 @@ scrape_configs: cert_file: valid_cert_file key_file: valid_key_file +- job_name: digitalocean-droplets + digitalocean_sd_configs: + - bearer_token: abcdef + - job_name: dockerswarm dockerswarm_sd_configs: - host: http://127.0.0.1:2375