diff options
author | Wolfy-J <[email protected]> | 2018-01-28 15:49:05 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-01-28 15:49:05 +0300 |
commit | 7e485c92cd7b745d4a0926c905e20dc68569ffbd (patch) | |
tree | 30f0355863699d2a59db8d480c28c33379542201 /socket_factory_test.go | |
parent | 2390c945478ad2bb00ab73ea98aad50a42d64f0b (diff) |
stop by worker
Diffstat (limited to 'socket_factory_test.go')
-rw-r--r-- | socket_factory_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/socket_factory_test.go b/socket_factory_test.go index c4c9b9d4..bb22e217 100644 --- a/socket_factory_test.go +++ b/socket_factory_test.go @@ -32,6 +32,24 @@ func Test_Tcp_Start(t *testing.T) { w.Stop() } +func Test_Tcp_StartError(t *testing.T) { + time.Sleep(time.Millisecond * 10) // to ensure free socket + + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer ls.Close() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "tests/client.php", "echo", "pipes") + cmd.Start() + + w, err := NewSocketFactory(ls, time.Minute).SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + func Test_Tcp_Failboot(t *testing.T) { time.Sleep(time.Millisecond * 10) // to ensure free socket |