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

Function TestPipelineCanceled

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

Source from the content-addressed store, hash-verified

259}
260
261func TestPipelineCanceled(t *testing.T) {
262 if runtime.GOOS == "windows" {
263 t.Skip("FIXME: test skipped on Windows: 'sleep' unavailable")
264 }
265
266 t.Parallel()
267
268 stdout := &bytes.Buffer{}
269
270 p := pipe.New(pipe.WithStdout(stdout))
271 p.Add(pipe.Command("sleep", "10"))
272
273 ctx, cancel := context.WithCancel(context.Background())
274
275 err := p.Start(ctx)
276 require.NoError(t, err)
277
278 cancel()
279
280 err = p.Wait()
281 assert.ErrorIs(t, err, context.Canceled)
282}
283
284// Verify the correct error if a command in the pipeline exits before
285// reading all of its predecessor's output. Note that the amount of

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