diff options
-rw-r--r-- | worker_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/worker_test.go b/worker_test.go index 61a2dd33..46eb5f7c 100644 --- a/worker_test.go +++ b/worker_test.go @@ -161,22 +161,23 @@ func Test_Echo_Slow(t *testing.T) { func Test_Broken(t *testing.T) { cmd := exec.Command("php", "tests/client.php", "broken", "pipes") - w, _ := NewPipeFactory().SpawnWorker(cmd) + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + go func() { err := w.Wait() assert.Error(t, err) assert.Contains(t, err.Error(), "undefined_function()") }() - - defer func() { - time.Sleep(time.Second) - err := w.Stop() - assert.NoError(t, err) - }() - + res, err := w.Exec(&Payload{Body: []byte("hello")}) assert.Nil(t, res) assert.NotNil(t, err) + + time.Sleep(time.Second) + assert.NoError(t, w.Stop()) } func Test_OnStarted(t *testing.T) { |