MCPcopy Create free account
hub / github.com/convox/rack / TestProcessExecError

Function TestProcessExecError

pkg/api/process_test.go:93–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestProcessExecError(t *testing.T) {
94 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {
95 a1 := fxApp
96 p.On("AppGet", "app1").Return(&a1, nil)
97 opts := structs.ProcessExecOptions{
98 Entrypoint: options.Bool(true),
99 Height: options.Int(1),
100 Tty: options.Bool(false),
101 Width: options.Int(2),
102 }
103 ro := stdsdk.RequestOptions{
104 Body: strings.NewReader("in"),
105 Headers: stdsdk.Headers{
106 "Command": "command",
107 "Entrypoint": "true",
108 "Height": "1",
109 "Tty": "false",
110 "Width": "2",
111 },
112 }
113 p.On("ProcessExec", "app1", "pid1", "command", mock.Anything, opts).Return(0, fmt.Errorf("err1"))
114 r, err := c.Websocket("/apps/app1/processes/pid1/exec", ro)
115 require.NoError(t, err)
116 d, err := io.ReadAll(r)
117 require.NoError(t, err)
118 require.Equal(t, []byte("ERROR: err1\n"), d)
119 })
120}
121
122func TestProcessExecValidate(t *testing.T) {
123 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {

Callers

nothing calls this directly

Calls 4

BoolFunction · 0.92
IntFunction · 0.92
WebsocketMethod · 0.80
testServerFunction · 0.70

Tested by

no test coverage detected