mirror of https://github.com/status-im/consul.git
Adds retry to API metrics test (flaky test).
This commit is contained in:
parent
b6de1f7446
commit
21f38bff6f
|
@ -9,6 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/testutil"
|
"github.com/hashicorp/consul/testutil"
|
||||||
|
"github.com/hashicorp/consul/testutil/retry"
|
||||||
"github.com/hashicorp/serf/serf"
|
"github.com/hashicorp/serf/serf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -42,16 +43,14 @@ func TestAPI_AgentMetrics(t *testing.T) {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var found bool
|
retry.Run(t, func(r *retry.R) {
|
||||||
for _, g := range metrics.Gauges {
|
for _, g := range metrics.Gauges {
|
||||||
if g.Name == "consul.runtime.alloc_bytes" {
|
if g.Name == "consul.runtime.alloc_bytes" {
|
||||||
found = true
|
return
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
r.Fatalf("missing runtime metrics")
|
||||||
t.Fatalf("missing runtime metrics")
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAPI_AgentReload(t *testing.T) {
|
func TestAPI_AgentReload(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue