Merge pull request #6771 from hashicorp/b-deflake-TestHTTP_FreshClientAllocMetrics-test

tests: deflake TestHTTP_FreshClientAllocMetrics
This commit is contained in:
Mahmood Ali
2019-11-25 08:33:03 -05:00
committed by GitHub

View File

@@ -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) {
@@ -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
}