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

Function TestWaitExitOrRemoved

cli/command/container/utils_test.go:42–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestWaitExitOrRemoved(t *testing.T) {
43 tests := []struct {
44 cid string
45 exitCode int
46 }{
47 {
48 cid: "normal-container",
49 exitCode: 0,
50 },
51 {
52 cid: "give-me-exit-code-42",
53 exitCode: 42,
54 },
55 {
56 cid: "i-want-a-wait-error",
57 exitCode: 125,
58 },
59 {
60 cid: "non-existent-container-id",
61 exitCode: 125,
62 },
63 }
64
65 apiClient := &fakeClient{waitFunc: waitFn, Version: client.MaxAPIVersion}
66 for _, tc := range tests {
67 t.Run(tc.cid, func(t *testing.T) {
68 statusC := waitExitOrRemoved(context.Background(), apiClient, tc.cid, true)
69 exitCode := <-statusC
70 assert.Check(t, is.Equal(tc.exitCode, exitCode))
71 })
72 }
73}

Callers

nothing calls this directly

Calls 1

waitExitOrRemovedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…