Add digitalocean test

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2020-07-21 23:28:43 +02:00
parent a197508d09
commit f8ec72d730
2 changed files with 28 additions and 1 deletions

View file

@ -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.")
}

View file

@ -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