tests: deflake TestClientAllocations_GarbageCollect_Remote

Use the same strategy as one in f2f383b07543a09ca989b82738926f7248e1ab28
This commit is contained in:
Mahmood Ali 2019-01-19 09:07:27 -05:00
parent d19ba5bd8e
commit e1803b685b

View file

@ -455,7 +455,19 @@ func TestClientAllocations_GarbageCollect_Remote(t *testing.T) {
}
testutil.WaitForResult(func() (bool, error) {
nodes := s2.connectedNodes()
return len(nodes) == 1, nil
if len(nodes) != 1 {
return false, fmt.Errorf("should have 1 client. found %d", len(nodes))
}
req := &structs.NodeSpecificRequest{
NodeID: c.NodeID(),
QueryOptions: structs.QueryOptions{Region: "global"},
}
resp := structs.SingleNodeResponse{}
if err := msgpackrpc.CallWithCodec(codec, "Node.GetNode", req, &resp); err != nil {
return false, err
}
return resp.Node != nil && resp.Node.Status == structs.NodeStatusReady, fmt.Errorf(
"expected ready but found %s", pretty.Sprint(resp.Node))
}, func(err error) {
t.Fatalf("should have a clients")
})