MCPcopy Index your code
hub / github.com/coder/coder / postSignal

Function postSignal

agent/agentproc/api_test.go:102–115  ·  view source on GitHub ↗

postSignal sends a POST /{id}/signal request and returns the recorder.

(t *testing.T, handler http.Handler, id string, req workspacesdk.SignalProcessRequest)

Source from the content-addressed store, hash-verified

100// postSignal sends a POST /{id}/signal request and returns
101// the recorder.
102func postSignal(t *testing.T, handler http.Handler, id string, req workspacesdk.SignalProcessRequest) *httptest.ResponseRecorder {
103 t.Helper()
104
105 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
106 defer cancel()
107
108 body, err := json.Marshal(req)
109 require.NoError(t, err)
110
111 w := httptest.NewRecorder()
112 r := httptest.NewRequestWithContext(ctx, http.MethodPost, fmt.Sprintf("/%s/signal", id), bytes.NewReader(body))
113 handler.ServeHTTP(w, r)
114 return w
115}
116
117// newTestAPI creates a new API with a test logger and default
118// execer, returning the handler and API.

Callers 4

TestListProcessesFunction · 0.85
TestProcessOutputFunction · 0.85
TestSignalProcessFunction · 0.85
TestProcessLifecycleFunction · 0.85

Calls 3

HelperMethod · 0.65
MarshalMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected