mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
lib/promscrape: reset ScrapeWork.ID in tests
This commit is contained in:
parent
88366cad15
commit
66da177fe9
@ -373,6 +373,12 @@ scrape_configs:
|
||||
`)
|
||||
}
|
||||
|
||||
func resetScrapeWorkIDs(sws []ScrapeWork) {
|
||||
for i := range sws {
|
||||
sws[i].ID = 0
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetFileSDScrapeWorkSuccess(t *testing.T) {
|
||||
f := func(data string, expectedSws []ScrapeWork) {
|
||||
t.Helper()
|
||||
@ -380,6 +386,7 @@ func TestGetFileSDScrapeWorkSuccess(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
resetScrapeWorkIDs(sws)
|
||||
if !reflect.DeepEqual(sws, expectedSws) {
|
||||
t.Fatalf("unexpected scrapeWork; got\n%v\nwant\n%v", sws, expectedSws)
|
||||
}
|
||||
@ -509,6 +516,7 @@ func TestGetStaticScrapeWorkSuccess(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
resetScrapeWorkIDs(sws)
|
||||
if !reflect.DeepEqual(sws, expectedSws) {
|
||||
t.Fatalf("unexpected scrapeWork; got\n%v\nwant\n%v", sws, expectedSws)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user