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

Method StopRecording

agent/x/agentdesktop/api_test.go:251–277  ·  view source on GitHub ↗
(ctx context.Context, recordingID string)

Source from the content-addressed store, hash-verified

249}
250
251func (f *oversizedFakeDesktop) StopRecording(ctx context.Context, recordingID string) (*agentdesktop.RecordingArtifact, error) {
252 artifact, err := f.fakeDesktop.StopRecording(ctx, recordingID)
253 if err != nil {
254 return nil, err
255 }
256 // Close the original reader since we're going to re-open after truncation.
257 artifact.Reader.Close()
258
259 // Look up the path from the fakeDesktop recordings.
260 f.fakeDesktop.recMu.Lock()
261 path := f.fakeDesktop.recordings[recordingID]
262 f.fakeDesktop.recMu.Unlock()
263
264 // Expand the file to exceed the maximum recording size.
265 if err := os.Truncate(path, workspacesdk.MaxRecordingSize+1); err != nil {
266 return nil, err
267 }
268 // Re-open the truncated file.
269 file, err := os.Open(path)
270 if err != nil {
271 return nil, err
272 }
273 return &agentdesktop.RecordingArtifact{
274 Reader: file,
275 Size: workspacesdk.MaxRecordingSize + 1,
276 }, nil
277}
278
279func TestHandleDesktopVNC_StartError(t *testing.T) {
280 t.Parallel()

Callers

nothing calls this directly

Calls 5

StopRecordingMethod · 0.65
CloseMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
OpenMethod · 0.45

Tested by

no test coverage detected