MCPcopy
hub / github.com/github/git-sizer / TestPipelineInterrupted

Function TestPipelineInterrupted

internal/pipe/pipeline_test.go:240–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

238}
239
240func TestPipelineInterrupted(t *testing.T) {
241 if runtime.GOOS == "windows" {
242 t.Skip("FIXME: test skipped on Windows: 'sleep' unavailable")
243 }
244
245 t.Parallel()
246 stdout := &bytes.Buffer{}
247
248 p := pipe.New(pipe.WithStdout(stdout))
249 p.Add(pipe.Command("sleep", "10"))
250
251 ctx, cancel := context.WithTimeout(context.Background(), 20*time.Millisecond)
252 defer cancel()
253
254 err := p.Start(ctx)
255 require.NoError(t, err)
256
257 err = p.Wait()
258 assert.ErrorIs(t, err, context.DeadlineExceeded)
259}
260
261func TestPipelineCanceled(t *testing.T) {
262 if runtime.GOOS == "windows" {

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WithStdoutFunction · 0.92
CommandFunction · 0.92
AddMethod · 0.65
StartMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected