summaryrefslogtreecommitdiff
path: root/transport
diff options
context:
space:
mode:
Diffstat (limited to 'transport')
-rw-r--r--transport/pipe/pipe_factory_spawn_test.go26
-rwxr-xr-xtransport/pipe/pipe_factory_test.go23
-rw-r--r--transport/socket/socket_factory_spawn_test.go46
-rwxr-xr-xtransport/socket/socket_factory_test.go47
4 files changed, 0 insertions, 142 deletions
diff --git a/transport/pipe/pipe_factory_spawn_test.go b/transport/pipe/pipe_factory_spawn_test.go
index 7e04f113..9aa12564 100644
--- a/transport/pipe/pipe_factory_spawn_test.go
+++ b/transport/pipe/pipe_factory_spawn_test.go
@@ -2,13 +2,11 @@ package pipe
import (
"os/exec"
- "strings"
"sync"
"testing"
"time"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/events"
"github.com/spiral/roadrunner/v2/payload"
"github.com/spiral/roadrunner/v2/worker"
"github.com/stretchr/testify/assert"
@@ -106,21 +104,9 @@ func Test_Pipe_PipeError4(t *testing.T) {
func Test_Pipe_Failboot2(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
-
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err := eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewPipeFactory().SpawnWorker(cmd)
-
assert.Nil(t, w)
assert.Error(t, err)
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Pipe_Invalid2(t *testing.T) {
@@ -364,29 +350,17 @@ func Test_Echo_Slow2(t *testing.T) {
func Test_Broken2(t *testing.T) {
cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err := eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewPipeFactory().SpawnWorker(cmd)
if err != nil {
t.Fatal(err)
}
sw := worker.From(w)
-
res, err := sw.Exec(&payload.Payload{Body: []byte("hello")})
assert.NotNil(t, err)
assert.Nil(t, res)
time.Sleep(time.Second * 3)
-
- msg := <-ch
- if strings.ContainsAny(msg.Message(), "undefined_function()") == false {
- t.Fail()
- }
assert.Error(t, w.Stop())
}
diff --git a/transport/pipe/pipe_factory_test.go b/transport/pipe/pipe_factory_test.go
index c69be298..cbf1431a 100755
--- a/transport/pipe/pipe_factory_test.go
+++ b/transport/pipe/pipe_factory_test.go
@@ -3,13 +3,11 @@ package pipe
import (
"context"
"os/exec"
- "strings"
"sync"
"testing"
"time"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/events"
"github.com/spiral/roadrunner/v2/payload"
"github.com/spiral/roadrunner/v2/worker"
"github.com/stretchr/testify/assert"
@@ -125,21 +123,10 @@ func Test_Pipe_Failboot(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
ctx := context.Background()
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err := eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd)
assert.Nil(t, w)
assert.Error(t, err)
-
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Pipe_Invalid(t *testing.T) {
@@ -442,12 +429,6 @@ func Test_Broken(t *testing.T) {
ctx := context.Background()
cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err := eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd)
if err != nil {
t.Fatal(err)
@@ -460,10 +441,6 @@ func Test_Broken(t *testing.T) {
assert.Nil(t, res)
time.Sleep(time.Second * 3)
- msg := <-ch
- if strings.ContainsAny(msg.Message(), "undefined_function()") == false {
- t.Fail()
- }
assert.Error(t, w.Stop())
}
diff --git a/transport/socket/socket_factory_spawn_test.go b/transport/socket/socket_factory_spawn_test.go
index fd852080..7fc6f4a5 100644
--- a/transport/socket/socket_factory_spawn_test.go
+++ b/transport/socket/socket_factory_spawn_test.go
@@ -3,13 +3,11 @@ package socket
import (
"net"
"os/exec"
- "strings"
"sync"
"syscall"
"testing"
"time"
- "github.com/spiral/roadrunner/v2/events"
"github.com/spiral/roadrunner/v2/payload"
"github.com/spiral/roadrunner/v2/worker"
"github.com/stretchr/testify/assert"
@@ -114,20 +112,9 @@ func Test_Tcp_Failboot2(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err2 := NewSocketServer(ls, time.Second*5).SpawnWorker(cmd)
assert.Nil(t, w)
assert.Error(t, err2)
-
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Tcp_Invalid2(t *testing.T) {
@@ -165,12 +152,6 @@ func Test_Tcp_Broken2(t *testing.T) {
cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd)
if err != nil {
t.Fatal(err)
@@ -189,11 +170,6 @@ func Test_Tcp_Broken2(t *testing.T) {
assert.Nil(t, res)
wg.Wait()
- ev := <-ch
- 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
@@ -273,20 +249,9 @@ func Test_Unix_Failboot2(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Second*5).SpawnWorker(cmd)
assert.Nil(t, w)
assert.Error(t, err)
-
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Unix_Timeout2(t *testing.T) {
@@ -330,12 +295,6 @@ func Test_Unix_Broken2(t *testing.T) {
cmd := exec.Command("php", "../../tests/client.php", "broken", "unix")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd)
if err != nil {
t.Fatal(err)
@@ -355,11 +314,6 @@ func Test_Unix_Broken2(t *testing.T) {
assert.Nil(t, res)
wg.Wait()
- ev := <-ch
- 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)
diff --git a/transport/socket/socket_factory_test.go b/transport/socket/socket_factory_test.go
index 10885bac..5a078be4 100755
--- a/transport/socket/socket_factory_test.go
+++ b/transport/socket/socket_factory_test.go
@@ -4,12 +4,10 @@ import (
"context"
"net"
"os/exec"
- "strings"
"sync"
"testing"
"time"
- "github.com/spiral/roadrunner/v2/events"
"github.com/spiral/roadrunner/v2/payload"
"github.com/spiral/roadrunner/v2/worker"
"github.com/stretchr/testify/assert"
@@ -128,20 +126,9 @@ func Test_Tcp_Failboot(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err2 := NewSocketServer(ls, time.Second*5).SpawnWorkerWithTimeout(ctx, cmd)
assert.Nil(t, w)
assert.Error(t, err2)
-
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Tcp_Timeout(t *testing.T) {
@@ -206,12 +193,6 @@ func Test_Tcp_Broken(t *testing.T) {
cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Second*10).SpawnWorkerWithTimeout(ctx, cmd)
if err != nil {
t.Fatal(err)
@@ -230,11 +211,6 @@ func Test_Tcp_Broken(t *testing.T) {
assert.Nil(t, res)
wg.Wait()
- ev := <-ch
- 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
@@ -368,20 +344,9 @@ func Test_Unix_Failboot(t *testing.T) {
cmd := exec.Command("php", "../../tests/failboot.php")
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Second*5).SpawnWorkerWithTimeout(ctx, cmd)
assert.Nil(t, w)
assert.Error(t, err)
-
- ev := <-ch
- if !strings.Contains(ev.Message(), "failboot") {
- t.Fatal("should contain failboot string")
- }
}
func Test_Unix_Timeout(t *testing.T) {
@@ -442,13 +407,6 @@ func Test_Unix_Broken(t *testing.T) {
}
cmd := exec.Command("php", "../../tests/client.php", "broken", "unix")
-
- eb, id := events.Bus()
- defer eb.Unsubscribe(id)
- ch := make(chan events.Event, 10)
- err = eb.SubscribeP(id, "worker.EventWorkerStderr", ch)
- require.NoError(t, err)
-
w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd)
if err != nil {
t.Fatal(err)
@@ -467,11 +425,6 @@ func Test_Unix_Broken(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, res)
- ev := <-ch
- 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)