It("does not error", func() { Expect(findErr).NotTo(HaveOccurred()) }) It("returns the build info", func() { Expect(b.Output).To(Equal([]byte("output from build"))) Expect(b.Finished).To(BeFalse()) }) }) Describe("streaming output from the build", func() { var ( streamer *chunkedio.ChunkedReader sErr error jobIdToStream string buildNumberToStream int startAtByte int64 ) BeforeEach(func() { jobIdToStream = jobId buildNumberToStream = 1 startAtByte = 0 }) JustBeforeEach(func() { streamer, sErr = repo.Stream(jobIdToStream, buildNumberToStream, startAtByte) }) Context("when the jobId and build number are valid", func() {
import ( "bytes" "io" "time" "github.com/craigfurman/woodhouse-ci/chunkedio" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("ChunkedReader", func() { var ( br *chunkedio.ChunkedReader writer *io.PipeWriter done bool ) BeforeEach(func() { var reader *io.PipeReader reader, writer = io.Pipe() br = &chunkedio.ChunkedReader{ Output: reader, DoneWriting: func() bool { return done }, Buffer: make([]byte, 1024), } }) Context("when the writer is already done and no output has been written", func() { BeforeEach(func() {