agent: Improve test reliability

This commit is contained in:
Armon Dadgar 2014-06-11 12:01:14 -07:00
parent 6d43b8cb6c
commit c74b42f629
1 changed files with 13 additions and 8 deletions

View File

@ -76,15 +76,20 @@ func TestCatalogDatacenters(t *testing.T) {
defer srv.Shutdown()
defer srv.agent.Shutdown()
obj, err := srv.CatalogDatacenters(nil, nil)
if err != nil {
t.Fatalf("err: %v", err)
}
testutil.WaitForResult(func() (bool, error) {
obj, err := srv.CatalogDatacenters(nil, nil)
if err != nil {
return false, err
}
dcs := obj.([]string)
if len(dcs) != 1 {
t.Fatalf("bad: %v", obj)
}
dcs := obj.([]string)
if len(dcs) != 1 {
return false, fmt.Errorf("missing dc: %v", dcs)
}
return true, nil
}, func(err error) {
t.Fatalf("bad: %v", err)
})
}
func TestCatalogNodes(t *testing.T) {