Skip to content

Commit

Permalink
Merge pull request #6771 from hashicorp/b-deflake-TestHTTP_FreshClien…
Browse files Browse the repository at this point in the history
…tAllocMetrics-test

tests: deflake TestHTTP_FreshClientAllocMetrics
  • Loading branch information
Mahmood Ali authored Nov 25, 2019
2 parents 46f7d44 + 2afc939 commit ca736e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions command/agent/metrics_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func TestHTTP_FreshClientAllocMetrics(t *testing.T) {
require.Fail("timed-out waiting for job to complete")
})

nodeID := s.client.NodeID()

// wait for metrics to converge
var pending, running, terminal float32 = -1.0, -1.0, -1.0
testutil.WaitForResultRetries(100, func() (bool, error) {
Expand All @@ -106,6 +108,13 @@ func TestHTTP_FreshClientAllocMetrics(t *testing.T) {

metrics := obj.(metrics.MetricsSummary)
for _, g := range metrics.Gauges {

// ignore client metrics belonging to other test nodes
// from other tests that contaminate go-metrics reporting
if g.DisplayLabels["node_id"] != nodeID {
continue
}

if strings.HasSuffix(g.Name, "client.allocations.pending") {
pending = g.Value
}
Expand Down

0 comments on commit ca736e6

Please sign in to comment.