func NewProcess( id uint32, containerPath string, iodaemonBin string, runner command_runner.CommandRunner, signaller Signaller, ) *Process { return &Process{ id: id, containerPath: containerPath, iodaemonBin: iodaemonBin, runner: runner, runningLink: &sync.Once{}, linked: make(chan struct{}), exited: make(chan struct{}), stdin: writer.NewFanIn(), stdout: writer.NewFanOut(), stderr: writer.NewFanOut(), signaller: signaller, } }
"github.com/cloudfoundry-incubator/garden-linux/process_tracker/writer" "strings" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("FanIn", func() { var fanIn writer.FanIn var fWriter *fakeWriter var testBytes []byte BeforeEach(func() { fanIn = writer.NewFanIn() fWriter = &fakeWriter{ nWriteReturn: 10, } testBytes = []byte{12} }) It("writes data to a sink and leaves the sink open", func() { fanIn.AddSink(fWriter) n, err := fanIn.Write(testBytes) Expect(err).ToNot(HaveOccurred()) Expect(n).To(Equal(10)) Expect(fWriter.writeCalls()).To(Equal(1)) Expect(fWriter.writeArgument()).To(Equal(testBytes)) Expect(fWriter.closeCalls()).To(Equal(0))