summaryrefslogtreecommitdiff
path: root/socket_factory_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'socket_factory_test.go')
-rw-r--r--socket_factory_test.go18
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