diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 01:42:52 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 01:42:52 +0300 |
commit | 4841b41b9a3b08a5c0f44d46c77d98fd6b4b88f5 (patch) | |
tree | e873eb688423efc77be81675b4c6c4b40a31b133 /worker_test.go | |
parent | c69a026d37a551d64c14c04e36690de63f873320 (diff) |
Remove defer from Test_Broken test (put statement at the end of the
func)
Diffstat (limited to 'worker_test.go')
-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) { |