(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…