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

Function TestLittleEPIPE

internal/pipe/pipeline_test.go:288–305  ·  view source on GitHub ↗

Verify the correct error if a command in the pipeline exits before reading all of its predecessor's output. Note that the amount of unread output in this case *does fit* within the OS-level pipe buffer.

(t *testing.T)

Source from the content-addressed store, hash-verified

286// unread output in this case *does fit* within the OS-level pipe
287// buffer.
288func TestLittleEPIPE(t *testing.T) {
289 if runtime.GOOS == "windows" {
290 t.Skip("FIXME: test skipped on Windows: 'sleep' unavailable")
291 }
292
293 t.Parallel()
294
295 p := pipe.New()
296 p.Add(
297 pipe.Command("sh", "-c", "sleep 1; echo foo"),
298 pipe.Command("true"),
299 )
300
301 ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
302 defer cancel()
303 err := p.Run(ctx)
304 assert.EqualError(t, err, "sh: signal: broken pipe")
305}
306
307// Verify the correct error if one command in the pipeline exits
308// before reading all of its predecessor's output. Note that the

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
CommandFunction · 0.92
RunMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected