MCPcopy
hub / github.com/docker/docker-agent / TestMaxIterationsAutoApproveJSONMode

Function TestMaxIterationsAutoApproveJSONMode

pkg/cli/runner_test.go:194–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

192}
193
194func TestMaxIterationsAutoApproveJSONMode(t *testing.T) {
195 t.Parallel()
196
197 rt := &mockRuntime{
198 events: []runtime.Event{maxIterEvent(60)},
199 }
200
201 var buf bytes.Buffer
202 out := NewPrinter(&buf)
203 sess := session.New()
204 cfg := Config{AutoApprove: true, OutputJSON: true}
205
206 err := Run(t.Context(), out, cfg, rt, sess, []string{"hello"})
207 assert.NilError(t, err)
208
209 resumes := rt.getResumes()
210 assert.Equal(t, len(resumes), 1)
211 assert.Equal(t, resumes[0].Type, runtime.ResumeTypeApprove)
212}
213
214func TestMaxIterationsRejectInJSONModeWithoutYolo(t *testing.T) {
215 t.Parallel()

Callers

nothing calls this directly

Calls 6

getResumesMethod · 0.95
NewFunction · 0.92
maxIterEventFunction · 0.85
NewPrinterFunction · 0.85
ContextMethod · 0.80
RunFunction · 0.70

Tested by

no test coverage detected