Skip to content

Commit

Permalink
Fix prom targets test
Browse files Browse the repository at this point in the history
Signed-off-by: Prem Saraswat <prmsrswt@gmail.com>
  • Loading branch information
onprem committed Apr 11, 2021
1 parent 571a6cd commit c368aa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/targets/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ scrape_configs:
}},
ScrapePool: "myself",
ScrapeUrl: fmt.Sprintf("http://%s/metrics", p.Addr()),
GlobalUrl: "",
Health: targetspb.TargetHealth_UP,
LastScrape: time.Time{},
LastScrapeDuration: 0,
Expand Down Expand Up @@ -151,6 +152,7 @@ scrape_configs:
targets.ActiveTargets[i].LastScrapeDuration = 0
targets.ActiveTargets[i].LastScrape = time.Time{}
targets.ActiveTargets[i].LastError = ""
targets.ActiveTargets[i].GlobalUrl = ""
}

testutil.Equals(t, expectedTargets.ActiveTargets, targets.ActiveTargets)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/targets_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func targetAndAssert(t *testing.T, ctx context.Context, addr string, state strin
for it := range res.ActiveTargets {
res.ActiveTargets[it].LastScrape = time.Time{}
res.ActiveTargets[it].LastScrapeDuration = 0
res.ActiveTargets[it].GlobalUrl = ""
}

sort.Slice(res.ActiveTargets, func(i, j int) bool { return res.ActiveTargets[i].Compare(res.ActiveTargets[j]) < 0 })
Expand Down

0 comments on commit c368aa0

Please sign in to comment.