(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func TestContainerWait(t *testing.T) { |
| 55 | ctx, cancel := context.WithCancel(t.Context()) |
| 56 | defer cancel() |
| 57 | |
| 58 | const expectedURL = "/containers/container_id/wait" |
| 59 | client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) { |
| 60 | if err := assertRequest(req, http.MethodPost, expectedURL); err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | return mockJSONResponse(http.StatusOK, nil, container.WaitResponse{ |
| 64 | StatusCode: 15, |
| 65 | })(req) |
| 66 | })) |
| 67 | assert.NilError(t, err) |
| 68 | |
| 69 | wait := client.ContainerWait(ctx, "container_id", ContainerWaitOptions{}) |
| 70 | select { |
| 71 | case err := <-wait.Error: |
| 72 | assert.NilError(t, err) |
| 73 | case result := <-wait.Result: |
| 74 | assert.Check(t, is.Equal(result.StatusCode, int64(15))) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func TestContainerWaitProxyInterrupt(t *testing.T) { |
| 79 | ctx, cancel := context.WithCancel(t.Context()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…