(service string)
| 409 | } |
| 410 | |
| 411 | func IsHealthy(service string) func(res *icmd.Result) bool { |
| 412 | return func(res *icmd.Result) bool { |
| 413 | type state struct { |
| 414 | Name string `json:"name"` |
| 415 | Health string `json:"health"` |
| 416 | } |
| 417 | |
| 418 | decoder := json.NewDecoder(strings.NewReader(res.Stdout())) |
| 419 | for decoder.More() { |
| 420 | ps := state{} |
| 421 | err := decoder.Decode(&ps) |
| 422 | if err != nil { |
| 423 | return false |
| 424 | } |
| 425 | if ps.Name == service && ps.Health == "healthy" { |
| 426 | return true |
| 427 | } |
| 428 | } |
| 429 | return false |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | // WaitForCmdResult try to execute a cmd until resulting output matches given predicate |
| 434 | func (c *CLI) WaitForCmdResult( |
no outgoing calls