diff --git a/packer_test/pipe_checker_test.go b/packer_test/pipe_checker_test.go index f5f5501f3..b34aa896b 100644 --- a/packer_test/pipe_checker_test.go +++ b/packer_test/pipe_checker_test.go @@ -5,6 +5,7 @@ import ( "regexp" "strconv" "strings" + "testing" ) // Pipe is any command that allows piping two gadgets together @@ -44,6 +45,16 @@ func LineCount() Pipe { }) } +// Tee pipes the output to stdout (as t.Logf) and forwards it, unaltered +// +// This is useful typically for troubleshooting a pipe that misbehaves +func Tee(t *testing.T) Pipe { + return CustomPipe(func(s string) (string, error) { + t.Logf(s) + return s, nil + }) +} + // Tester is the end of a pipe for testing purposes. // // Once multiple commands have been piped together in a pipeline, we can