(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func 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 | |
| 117 | func TestExecStartConsoleSize(t *testing.T) { |
| 118 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…