summaryrefslogtreecommitdiff
path: root/socket_factory_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-05 16:56:12 +0300
committerWolfy-J <[email protected]>2018-06-05 16:56:12 +0300
commit3112f9b58c73773cea972fd79f04d33f8f7d7edd (patch)
tree334941e56becd1dde9fd1ce353e63d63775d772b /socket_factory_test.go
parent76ff8d1c95e087749d559ee5a4f8f0348feafffa (diff)
Cs and refactoring
Diffstat (limited to 'socket_factory_test.go')
-rw-r--r--socket_factory_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/socket_factory_test.go b/socket_factory_test.go
index 3bb60ab0..f6b1350c 100644
--- a/socket_factory_test.go
+++ b/socket_factory_test.go
@@ -32,6 +32,31 @@ func Test_Tcp_Start(t *testing.T) {
w.Stop()
}
+func Test_Tcp_StartCloseFactory(t *testing.T) {
+ time.Sleep(time.Millisecond * 10) // to ensure free socket
+
+ ls, err := net.Listen("tcp", "localhost:9007")
+ if assert.NoError(t, err) {
+ } else {
+ t.Skip("socket is busy")
+ }
+
+ cmd := exec.Command("php", "php-src/tests/client.php", "echo", "tcp")
+
+ f := NewSocketFactory(ls, time.Minute)
+ defer f.Close()
+
+ w, err := f.SpawnWorker(cmd)
+ assert.NoError(t, err)
+ assert.NotNil(t, w)
+
+ go func() {
+ assert.NoError(t, w.Wait())
+ }()
+
+ w.Stop()
+}
+
func Test_Tcp_StartError(t *testing.T) {
time.Sleep(time.Millisecond * 10) // to ensure free socket