MCPcopy Index your code
hub / github.com/docker/cli / waitFn

Function waitFn

cli/command/container/utils_test.go:15–40  ·  view source on GitHub ↗
(cid string)

Source from the content-addressed store, hash-verified

13)
14
15func 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
42func TestWaitExitOrRemoved(t *testing.T) {
43 tests := []struct {

Callers

nothing calls this directly

Calls 1

ContainsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…