mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
cmd/promtool: in tests use labels.FromStrings
Replacing code which assumes the internal structure of `Labels`. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
8297f5cb6b
commit
c438b50133
2 changed files with 16 additions and 22 deletions
|
@ -51,20 +51,20 @@ func TestSDCheckResult(t *testing.T) {
|
|||
|
||||
expectedSDCheckResult := []sdCheckResult{
|
||||
{
|
||||
DiscoveredLabels: labels.Labels{
|
||||
labels.Label{Name: "__address__", Value: "localhost:8080"},
|
||||
labels.Label{Name: "__scrape_interval__", Value: "1m"},
|
||||
labels.Label{Name: "__scrape_timeout__", Value: "10s"},
|
||||
labels.Label{Name: "foo", Value: "bar"},
|
||||
},
|
||||
Labels: labels.Labels{
|
||||
labels.Label{Name: "__address__", Value: "localhost:8080"},
|
||||
labels.Label{Name: "__scrape_interval__", Value: "1m"},
|
||||
labels.Label{Name: "__scrape_timeout__", Value: "10s"},
|
||||
labels.Label{Name: "foo", Value: "bar"},
|
||||
labels.Label{Name: "instance", Value: "localhost:8080"},
|
||||
labels.Label{Name: "newfoo", Value: "bar"},
|
||||
},
|
||||
DiscoveredLabels: labels.FromStrings(
|
||||
"__address__", "localhost:8080",
|
||||
"__scrape_interval__", "1m",
|
||||
"__scrape_timeout__", "10s",
|
||||
"foo", "bar",
|
||||
),
|
||||
Labels: labels.FromStrings(
|
||||
"__address__", "localhost:8080",
|
||||
"__scrape_interval__", "1m",
|
||||
"__scrape_timeout__", "10s",
|
||||
"foo", "bar",
|
||||
"instance", "localhost:8080",
|
||||
"newfoo", "bar",
|
||||
),
|
||||
Error: nil,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue