Update package scrape tests for new labels.Labels type
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
91254fb187
commit
9bc6d7a7db
|
@ -149,8 +149,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "no address",
|
||||
},
|
||||
// Address label missing, but added in relabelling.
|
||||
|
@ -242,8 +242,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "invalid label value for \"custom\": \"\\xbd\"",
|
||||
},
|
||||
// Invalid duration in interval label.
|
||||
|
@ -259,8 +259,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "error parsing scrape interval: not a valid duration string: \"2notseconds\"",
|
||||
},
|
||||
// Invalid duration in timeout label.
|
||||
|
@ -276,8 +276,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "error parsing scrape timeout: not a valid duration string: \"2notseconds\"",
|
||||
},
|
||||
// 0 interval in timeout label.
|
||||
|
@ -293,8 +293,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "scrape interval cannot be 0",
|
||||
},
|
||||
// 0 duration in timeout label.
|
||||
|
@ -310,8 +310,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "scrape timeout cannot be 0",
|
||||
},
|
||||
// Timeout less than interval.
|
||||
|
@ -328,8 +328,8 @@ func TestPopulateLabels(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(time.Second),
|
||||
ScrapeTimeout: model.Duration(time.Second),
|
||||
},
|
||||
res: nil,
|
||||
resOrig: nil,
|
||||
res: labels.EmptyLabels(),
|
||||
resOrig: labels.EmptyLabels(),
|
||||
err: "scrape timeout cannot be greater than scrape interval (\"2s\" > \"1s\")",
|
||||
},
|
||||
// Don't attach default port.
|
||||
|
|
|
@ -1623,7 +1623,7 @@ func TestScrapeLoopAppendSampleLimit(t *testing.T) {
|
|||
nil, nil, nil,
|
||||
func(l labels.Labels) labels.Labels {
|
||||
if l.Has("deleteme") {
|
||||
return nil
|
||||
return labels.EmptyLabels()
|
||||
}
|
||||
return l
|
||||
},
|
||||
|
|
|
@ -129,7 +129,7 @@ func newTestTarget(targetURL string, deadline time.Duration, lbls labels.Labels)
|
|||
lb.Set(model.AddressLabel, strings.TrimPrefix(targetURL, "http://"))
|
||||
lb.Set(model.MetricsPathLabel, "/metrics")
|
||||
|
||||
return &Target{labels: lb.Labels(nil)}
|
||||
return &Target{labels: lb.Labels(labels.EmptyLabels())}
|
||||
}
|
||||
|
||||
func TestNewHTTPBearerToken(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue