mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
f06c7e99fe
This commit adds support for [PuppetDB](https://www.puppet.com/docs/puppetdb/8/overview.html) service discovery to the `vmagent` and `victoria-metrics-single` components. Related issue https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5744
25 lines
864 B
Go
25 lines
864 B
Go
package puppetdb
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_newAPIConfig(t *testing.T) {
|
|
f := func(url, query string, includeParameters bool, port int, wantErr bool) {
|
|
t.Helper()
|
|
sdc := &SDConfig{
|
|
URL: url,
|
|
Query: query,
|
|
IncludeParameters: includeParameters,
|
|
Port: port,
|
|
}
|
|
if _, err := newAPIConfig(sdc, ""); wantErr != (err != nil) {
|
|
t.Fatalf("newAPIConfig want error = %t, but error = %v", wantErr, err)
|
|
}
|
|
}
|
|
|
|
f("https://puppetdb.example.com", `resources { type = "Class" and title = "Prometheus::Node_exporter" }`, true, 9100, false)
|
|
f("", `resources { type = "Class" and title = "Prometheus::Node_exporter" }`, true, 9100, true)
|
|
f("https://puppetdb.example.com", ``, true, 9100, true)
|
|
f("ftp://invalid.url", `resources { type = "Class" and title = "Prometheus::Node_exporter" }`, true, 9100, true)
|
|
}
|