MCPcopy
hub / github.com/moby/moby / TestExecCreateError

Function TestExecCreateError

client/container_exec_test.go:16–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestExecCreateError(t *testing.T) {
17 client, err := New(
18 WithMockClient(errorMock(http.StatusInternalServerError, "Server error")),
19 )
20 assert.NilError(t, err)
21
22 _, err = client.ExecCreate(t.Context(), "container_id", ExecCreateOptions{})
23 assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
24
25 _, err = client.ExecCreate(t.Context(), "", ExecCreateOptions{})
26 assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
27 assert.Check(t, is.ErrorContains(err, "value is empty"))
28
29 _, err = client.ExecCreate(t.Context(), " ", ExecCreateOptions{})
30 assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
31 assert.Check(t, is.ErrorContains(err, "value is empty"))
32}
33
34// TestExecCreateConnectionError verifies that connection errors occurring
35// during API-version negotiation are not shadowed by API-version errors.

Callers

nothing calls this directly

Calls 6

WithMockClientFunction · 0.85
errorMockFunction · 0.85
CheckMethod · 0.80
NewFunction · 0.70
ExecCreateMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…