MCPcopy
hub / github.com/moby/moby / TestExecInspect

Function TestExecInspect

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

Source from the content-addressed store, hash-verified

185}
186
187func TestExecInspect(t *testing.T) {
188 const expectedURL = "/exec/exec_id/json"
189 client, err := New(
190 WithMockClient(func(req *http.Request) (*http.Response, error) {
191 if err := assertRequest(req, http.MethodGet, expectedURL); err != nil {
192 return nil, err
193 }
194 return mockJSONResponse(http.StatusOK, nil, container.ExecInspectResponse{
195 ID: "exec_id",
196 ContainerID: "container_id",
197 })(req)
198 }),
199 )
200 assert.NilError(t, err)
201
202 inspect, err := client.ExecInspect(t.Context(), "exec_id", ExecInspectOptions{})
203 assert.NilError(t, err)
204 assert.Check(t, is.Equal(inspect.ID, "exec_id"))
205 assert.Check(t, is.Equal(inspect.ContainerID, "container_id"))
206}

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockJSONResponseFunction · 0.85
CheckMethod · 0.80
EqualMethod · 0.80
NewFunction · 0.70
ExecInspectMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…