Skip to content

Commit bbc951f

Browse files
committed
Add config tests for kuma SD
Signed-off-by: austin ce <[email protected]>
1 parent 0544bdd commit bbc951f

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

config/config_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"github.com/prometheus/prometheus/discovery/scaleway"
4949
"github.com/prometheus/prometheus/discovery/targetgroup"
5050
"github.com/prometheus/prometheus/discovery/triton"
51+
"github.com/prometheus/prometheus/discovery/xds"
5152
"github.com/prometheus/prometheus/discovery/zookeeper"
5253
"github.com/prometheus/prometheus/pkg/labels"
5354
"github.com/prometheus/prometheus/pkg/relabel"
@@ -439,6 +440,26 @@ var expectedConf = &Config{
439440
},
440441
},
441442
},
443+
{
444+
JobName: "service-kuma",
445+
446+
HonorTimestamps: true,
447+
ScrapeInterval: model.Duration(15 * time.Second),
448+
ScrapeTimeout: DefaultGlobalConfig.ScrapeTimeout,
449+
450+
MetricsPath: DefaultScrapeConfig.MetricsPath,
451+
Scheme: DefaultScrapeConfig.Scheme,
452+
HTTPClientConfig: config.DefaultHTTPClientConfig,
453+
454+
ServiceDiscoveryConfigs: discovery.Configs{
455+
&xds.KumaSDConfig{
456+
Server: "http://kuma-control-plane.kuma-system.svc:5676",
457+
HTTPClientConfig: config.DefaultHTTPClientConfig,
458+
RefreshInterval: model.Duration(15 * time.Second),
459+
FetchTimeout: model.Duration(2 * time.Minute),
460+
},
461+
},
462+
},
442463
{
443464
JobName: "service-marathon",
444465

config/testdata/conf.good.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ scrape_configs:
109109
- second.dns.address.domain.com
110110
- names:
111111
- first.dns.address.domain.com
112-
# refresh_interval defaults to 30s.
113112

114113
relabel_configs:
115114
- source_labels: [job]
@@ -193,6 +192,11 @@ scrape_configs:
193192
username: "myusername"
194193
password_file: valid_password_file
195194

195+
- job_name: service-kuma
196+
197+
kuma_sd_configs:
198+
- server: http://kuma-control-plane.kuma-system.svc:5676
199+
196200
- job_name: service-marathon
197201
marathon_sd_configs:
198202
- servers:

config/testdata/roundtrip.good.yml

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ scrape_configs:
106106
username: username
107107
password_file: valid_password_file
108108

109+
kuma_sd_configs:
110+
- server: http://kuma-control-plane.kuma-system.svc:5676
111+
109112
marathon_sd_configs:
110113
- servers:
111114
- https://marathon.example.com:443

0 commit comments

Comments
 (0)