TestContainerWaitConnectionError verifies that connection errors occurring during API-version negotiation are not shadowed by API-version errors. Regression test for https://github.com/docker/cli/issues/4890
(t *testing.T)
| 36 | // |
| 37 | // Regression test for https://github.com/docker/cli/issues/4890 |
| 38 | func TestContainerWaitConnectionError(t *testing.T) { |
| 39 | ctx, cancel := context.WithCancel(t.Context()) |
| 40 | defer cancel() |
| 41 | |
| 42 | client, err := New(WithHost("tcp://no-such-host.invalid")) |
| 43 | assert.NilError(t, err) |
| 44 | |
| 45 | wait := client.ContainerWait(ctx, "nothing", ContainerWaitOptions{}) |
| 46 | select { |
| 47 | case result := <-wait.Result: |
| 48 | t.Fatalf("expected to not get a wait result, got %d", result.StatusCode) |
| 49 | case err := <-wait.Error: |
| 50 | assert.Check(t, is.ErrorType(err, IsErrConnectionFailed)) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestContainerWait(t *testing.T) { |
| 55 | ctx, cancel := context.WithCancel(t.Context()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…