(cid string)
| 13 | ) |
| 14 | |
| 15 | func waitFn(cid string) client.ContainerWaitResult { |
| 16 | resC := make(chan container.WaitResponse) |
| 17 | errC := make(chan error, 1) |
| 18 | var res container.WaitResponse |
| 19 | |
| 20 | go func() { |
| 21 | switch { |
| 22 | case strings.Contains(cid, "exit-code-42"): |
| 23 | res.StatusCode = 42 |
| 24 | resC <- res |
| 25 | case strings.Contains(cid, "non-existent"): |
| 26 | err := fmt.Errorf("no such container: %v", cid) |
| 27 | errC <- err |
| 28 | case strings.Contains(cid, "wait-error"): |
| 29 | res.Error = &container.WaitExitError{Message: "removal failed"} |
| 30 | resC <- res |
| 31 | default: |
| 32 | // normal exit |
| 33 | resC <- res |
| 34 | } |
| 35 | }() |
| 36 | return client.ContainerWaitResult{ |
| 37 | Result: resC, |
| 38 | Error: errC, |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestWaitExitOrRemoved(t *testing.T) { |
| 43 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…