MCPcopy
hub / github.com/moby/moby / TestContainerWaitConnectionError

Function TestContainerWaitConnectionError

client/container_wait_test.go:38–52  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

36//
37// Regression test for https://github.com/docker/cli/issues/4890
38func 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
54func TestContainerWait(t *testing.T) {
55 ctx, cancel := context.WithCancel(t.Context())

Callers

nothing calls this directly

Calls 5

WithHostFunction · 0.85
CheckMethod · 0.80
NewFunction · 0.70
ContextMethod · 0.65
ContainerWaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…