(ctx context.Context, recordingID string)
| 249 | } |
| 250 | |
| 251 | func (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 | |
| 279 | func TestHandleDesktopVNC_StartError(t *testing.T) { |
| 280 | t.Parallel() |
nothing calls this directly
no test coverage detected