scrape tests: undo EmptyLabels change

Needs other code changes otherwise tests fail

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2022-07-29 13:20:44 +01:00 committed by Julien Pivotto
parent c438b50133
commit 4927e13537
2 changed files with 15 additions and 15 deletions

View File

@ -149,8 +149,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "no address", err: "no address",
}, },
// Address label missing, but added in relabelling. // Address label missing, but added in relabelling.
@ -242,8 +242,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "invalid label value for \"custom\": \"\\xbd\"", err: "invalid label value for \"custom\": \"\\xbd\"",
}, },
// Invalid duration in interval label. // Invalid duration in interval label.
@ -259,8 +259,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "error parsing scrape interval: not a valid duration string: \"2notseconds\"", err: "error parsing scrape interval: not a valid duration string: \"2notseconds\"",
}, },
// Invalid duration in timeout label. // Invalid duration in timeout label.
@ -276,8 +276,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "error parsing scrape timeout: not a valid duration string: \"2notseconds\"", err: "error parsing scrape timeout: not a valid duration string: \"2notseconds\"",
}, },
// 0 interval in timeout label. // 0 interval in timeout label.
@ -293,8 +293,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "scrape interval cannot be 0", err: "scrape interval cannot be 0",
}, },
// 0 duration in timeout label. // 0 duration in timeout label.
@ -310,8 +310,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "scrape timeout cannot be 0", err: "scrape timeout cannot be 0",
}, },
// Timeout less than interval. // Timeout less than interval.
@ -328,8 +328,8 @@ func TestPopulateLabels(t *testing.T) {
ScrapeInterval: model.Duration(time.Second), ScrapeInterval: model.Duration(time.Second),
ScrapeTimeout: model.Duration(time.Second), ScrapeTimeout: model.Duration(time.Second),
}, },
res: labels.EmptyLabels(), res: nil,
resOrig: labels.EmptyLabels(), resOrig: nil,
err: "scrape timeout cannot be greater than scrape interval (\"2s\" > \"1s\")", err: "scrape timeout cannot be greater than scrape interval (\"2s\" > \"1s\")",
}, },
// Don't attach default port. // Don't attach default port.

View File

@ -1577,7 +1577,7 @@ func TestScrapeLoopAppendSampleLimit(t *testing.T) {
nil, nil, nil, nil, nil, nil,
func(l labels.Labels) labels.Labels { func(l labels.Labels) labels.Labels {
if l.Has("deleteme") { if l.Has("deleteme") {
return labels.EmptyLabels() return nil
} }
return l return l
}, },