MCPcopy
hub / github.com/moby/moby / TestContainerRestartError

Function TestContainerRestartError

client/container_restart_test.go:13–26  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestContainerRestartError(t *testing.T) {
14 client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
15 assert.NilError(t, err)
16 _, err = client.ContainerRestart(t.Context(), "nothing", ContainerRestartOptions{})
17 assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
18
19 _, err = client.ContainerRestart(t.Context(), "", ContainerRestartOptions{})
20 assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
21 assert.Check(t, is.ErrorContains(err, "value is empty"))
22
23 _, err = client.ContainerRestart(t.Context(), " ", ContainerRestartOptions{})
24 assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
25 assert.Check(t, is.ErrorContains(err, "value is empty"))
26}
27
28// TestContainerRestartConnectionError verifies that connection errors occurring
29// 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
ContainerRestartMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…