MCPcopy
hub / github.com/moby/moby / TestExecStart

Function TestExecStart

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

Source from the content-addressed store, hash-verified

86}
87
88func TestExecStart(t *testing.T) {
89 const expectedURL = "/exec/exec_id/start"
90 client, err := New(
91 WithMockClient(func(req *http.Request) (*http.Response, error) {
92 if err := assertRequest(req, http.MethodPost, expectedURL); err != nil {
93 return nil, err
94 }
95 if err := req.ParseForm(); err != nil {
96 return nil, err
97 }
98 request := &container.ExecStartRequest{}
99 if err := json.NewDecoder(req.Body).Decode(request); err != nil {
100 return nil, err
101 }
102 if request.Tty || !request.Detach {
103 return nil, fmt.Errorf("expected ExecStartOptions{Detach:true,Tty:false}, got %v", request)
104 }
105 return mockResponse(http.StatusOK, nil, "")(req)
106 }),
107 )
108 assert.NilError(t, err)
109
110 _, err = client.ExecStart(t.Context(), "exec_id", ExecStartOptions{
111 Detach: true,
112 TTY: false,
113 })
114 assert.NilError(t, err)
115}
116
117func TestExecStartConsoleSize(t *testing.T) {
118 tests := []struct {

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockResponseFunction · 0.85
ErrorfMethod · 0.80
NewFunction · 0.70
DecodeMethod · 0.65
ExecStartMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…