diff options
Diffstat (limited to 'transport/socket/socket_factory_spawn_test.go')
-rw-r--r-- | transport/socket/socket_factory_spawn_test.go | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/transport/socket/socket_factory_spawn_test.go b/transport/socket/socket_factory_spawn_test.go index 2db2fd40..fd852080 100644 --- a/transport/socket/socket_factory_spawn_test.go +++ b/transport/socket/socket_factory_spawn_test.go @@ -53,7 +53,6 @@ func Test_Tcp_StartCloseFactory2(t *testing.T) { } cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") - f := NewSocketServer(ls, time.Minute) defer func() { err = ls.Close() @@ -66,6 +65,10 @@ func Test_Tcp_StartCloseFactory2(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, w) + go func() { + require.NoError(t, w.Wait()) + }() + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) @@ -180,15 +183,7 @@ func Test_Tcp_Broken2(t *testing.T) { assert.Error(t, errW) }() - defer func() { - time.Sleep(time.Second) - err2 := w.Stop() - // write tcp 127.0.0.1:9007->127.0.0.1:34204: use of closed network connection - assert.Error(t, err2) - }() - sw := worker.From(w) - res, err := sw.Exec(&payload.Payload{Body: []byte("hello")}) assert.Error(t, err) assert.Nil(t, res) @@ -198,6 +193,12 @@ func Test_Tcp_Broken2(t *testing.T) { if !strings.Contains(ev.Message(), "undefined_function()") { t.Fatal("should contain undefined_function() string") } + + time.Sleep(time.Second) + err2 := w.Stop() + // write tcp 127.0.0.1:9007->127.0.0.1:34204: use of closed network connection + // but process exited + assert.NoError(t, err2) } func Test_Tcp_Echo2(t *testing.T) { @@ -347,14 +348,7 @@ func Test_Unix_Broken2(t *testing.T) { assert.Error(t, errW) }() - defer func() { - time.Sleep(time.Second) - err = w.Stop() - assert.Error(t, err) - }() - sw := worker.From(w) - res, err := sw.Exec(&payload.Payload{Body: []byte("hello")}) assert.Error(t, err) @@ -365,6 +359,10 @@ func Test_Unix_Broken2(t *testing.T) { if !strings.Contains(ev.Message(), "undefined_function()") { t.Fatal("should contain undefined_function string") } + + time.Sleep(time.Second) + err = w.Stop() + assert.NoError(t, err) } func Test_Unix_Echo2(t *testing.T) { |