diff options
Diffstat (limited to 'pkg/transport/pipe/pipe_factory_spawn_test.go')
-rw-r--r-- | pkg/transport/pipe/pipe_factory_spawn_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/transport/pipe/pipe_factory_spawn_test.go b/pkg/transport/pipe/pipe_factory_spawn_test.go index e247324c..73008471 100644 --- a/pkg/transport/pipe/pipe_factory_spawn_test.go +++ b/pkg/transport/pipe/pipe_factory_spawn_test.go @@ -106,11 +106,21 @@ func Test_Pipe_PipeError4(t *testing.T) { func Test_Pipe_Failboot2(t *testing.T) { cmd := exec.Command("php", "../../../tests/failboot.php") - w, err := NewPipeFactory().SpawnWorker(cmd) + finish := make(chan struct{}, 10) + listener := func(event interface{}) { + if ev, ok := event.(events.WorkerEvent); ok { + if ev.Event == events.EventWorkerStderr { + if strings.Contains(string(ev.Payload.([]byte)), "failboot") { + finish <- struct{}{} + } + } + } + } + w, err := NewPipeFactory().SpawnWorker(cmd, listener) assert.Nil(t, w) assert.Error(t, err) - assert.Contains(t, err.Error(), "failboot") + <-finish } func Test_Pipe_Invalid2(t *testing.T) { |