diff --git a/command/agent/metrics_endpoint_test.go b/command/agent/metrics_endpoint_test.go index d97fe2e69..b10e41708 100644 --- a/command/agent/metrics_endpoint_test.go +++ b/command/agent/metrics_endpoint_test.go @@ -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 }