mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-19 15:30:17 +00:00
lib/promscrape: fix TestGetFileSDScrapeWorkSuccess after 3b234d82e5
This commit is contained in:
parent
f422203e10
commit
f25416984b
1 changed files with 14 additions and 3 deletions
|
@ -387,6 +387,17 @@ func TestGetFileSDScrapeWorkSuccess(t *testing.T) {
|
||||||
t.Fatalf("unexpected error: %s", err)
|
t.Fatalf("unexpected error: %s", err)
|
||||||
}
|
}
|
||||||
resetScrapeWorkIDs(sws)
|
resetScrapeWorkIDs(sws)
|
||||||
|
|
||||||
|
// Remove `__vm_filepath` label, since its value depends on the current working dir.
|
||||||
|
for i := range sws {
|
||||||
|
sw := &sws[i]
|
||||||
|
for j := range sw.Labels {
|
||||||
|
label := &sw.Labels[j]
|
||||||
|
if label.Name == "__vm_filepath" {
|
||||||
|
label.Value = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if !reflect.DeepEqual(sws, expectedSws) {
|
if !reflect.DeepEqual(sws, expectedSws) {
|
||||||
t.Fatalf("unexpected scrapeWork; got\n%v\nwant\n%v", sws, expectedSws)
|
t.Fatalf("unexpected scrapeWork; got\n%v\nwant\n%v", sws, expectedSws)
|
||||||
}
|
}
|
||||||
|
@ -425,7 +436,7 @@ scrape_configs:
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "__vm_filepath",
|
Name: "__vm_filepath",
|
||||||
Value: "testdata/file_sd.json",
|
Value: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "job",
|
Name: "job",
|
||||||
|
@ -459,7 +470,7 @@ scrape_configs:
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "__vm_filepath",
|
Name: "__vm_filepath",
|
||||||
Value: "testdata/file_sd.json",
|
Value: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "job",
|
Name: "job",
|
||||||
|
@ -493,7 +504,7 @@ scrape_configs:
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "__vm_filepath",
|
Name: "__vm_filepath",
|
||||||
Value: "testdata/file_sd_1.yml",
|
Value: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "job",
|
Name: "job",
|
||||||
|
|
Loading…
Reference in a new issue