mirror of https://github.com/status-im/consul.git
agent: Improve test reliability
This commit is contained in:
parent
6d43b8cb6c
commit
c74b42f629
|
@ -76,15 +76,20 @@ func TestCatalogDatacenters(t *testing.T) {
|
||||||
defer srv.Shutdown()
|
defer srv.Shutdown()
|
||||||
defer srv.agent.Shutdown()
|
defer srv.agent.Shutdown()
|
||||||
|
|
||||||
|
testutil.WaitForResult(func() (bool, error) {
|
||||||
obj, err := srv.CatalogDatacenters(nil, nil)
|
obj, err := srv.CatalogDatacenters(nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
dcs := obj.([]string)
|
dcs := obj.([]string)
|
||||||
if len(dcs) != 1 {
|
if len(dcs) != 1 {
|
||||||
t.Fatalf("bad: %v", obj)
|
return false, fmt.Errorf("missing dc: %v", dcs)
|
||||||
}
|
}
|
||||||
|
return true, nil
|
||||||
|
}, func(err error) {
|
||||||
|
t.Fatalf("bad: %v", err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCatalogNodes(t *testing.T) {
|
func TestCatalogNodes(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue