summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-23 23:38:10 +0300
committerValery Piashchynski <[email protected]>2021-01-23 23:38:10 +0300
commit7fb3cc3588cfde9260a6bb431330ce1e0a71f56d (patch)
tree3200cf2136f7413a7e1cfc6ecdaa83716f9655f9 /tests
parentee5d34abde7f3931bf939498eb7a8cb170232f4f (diff)
interfaces folder deprecated
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/http/handler_test.go218
-rw-r--r--tests/plugins/http/http_plugin_test.go2
-rw-r--r--tests/plugins/http/uploads_test.go2
-rw-r--r--tests/plugins/informer/test_plugin.go18
-rw-r--r--tests/plugins/server/plugin_pipes.go8
-rw-r--r--tests/plugins/server/plugin_sockets.go8
-rw-r--r--tests/plugins/server/plugin_tcp.go8
7 files changed, 129 insertions, 135 deletions
diff --git a/tests/plugins/http/handler_test.go b/tests/plugins/http/handler_test.go
index ee6f795d..45931a49 100644
--- a/tests/plugins/http/handler_test.go
+++ b/tests/plugins/http/handler_test.go
@@ -10,8 +10,8 @@ import (
"runtime"
"strings"
- "github.com/spiral/roadrunner/v2/pkg/pipe"
- poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
+ "github.com/spiral/roadrunner/v2/pkg/pool"
+ "github.com/spiral/roadrunner/v2/pkg/transport/pipe"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/http/config"
"github.com/stretchr/testify/assert"
@@ -23,10 +23,10 @@ import (
)
func TestHandler_Echo(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "echo", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -38,7 +38,7 @@ func TestHandler_Echo(t *testing.T) {
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -74,10 +74,10 @@ func Test_HandlerErrors(t *testing.T) {
}
func TestHandler_Headers(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "header", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -86,13 +86,13 @@ func TestHandler_Headers(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8078", Handler: h}
@@ -135,10 +135,10 @@ func TestHandler_Headers(t *testing.T) {
}
func TestHandler_Empty_User_Agent(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "user-agent", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -147,13 +147,13 @@ func TestHandler_Empty_User_Agent(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8088", Handler: h}
@@ -195,10 +195,10 @@ func TestHandler_Empty_User_Agent(t *testing.T) {
}
func TestHandler_User_Agent(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "user-agent", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -207,13 +207,13 @@ func TestHandler_User_Agent(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8088", Handler: h}
@@ -255,10 +255,10 @@ func TestHandler_User_Agent(t *testing.T) {
}
func TestHandler_Cookies(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "cookie", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -267,13 +267,13 @@ func TestHandler_Cookies(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8079", Handler: h}
@@ -320,10 +320,10 @@ func TestHandler_Cookies(t *testing.T) {
}
func TestHandler_JsonPayload_POST(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "payload", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -332,13 +332,13 @@ func TestHandler_JsonPayload_POST(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8090", Handler: h}
@@ -384,10 +384,10 @@ func TestHandler_JsonPayload_POST(t *testing.T) {
}
func TestHandler_JsonPayload_PUT(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "payload", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -396,13 +396,13 @@ func TestHandler_JsonPayload_PUT(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8081", Handler: h}
@@ -444,10 +444,10 @@ func TestHandler_JsonPayload_PUT(t *testing.T) {
}
func TestHandler_JsonPayload_PATCH(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "payload", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -456,13 +456,13 @@ func TestHandler_JsonPayload_PATCH(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8082", Handler: h}
@@ -504,10 +504,10 @@ func TestHandler_JsonPayload_PATCH(t *testing.T) {
}
func TestHandler_FormData_POST(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -516,13 +516,13 @@ func TestHandler_FormData_POST(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8083", Handler: h}
@@ -577,10 +577,10 @@ func TestHandler_FormData_POST(t *testing.T) {
}
func TestHandler_FormData_POST_Overwrite(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -589,13 +589,13 @@ func TestHandler_FormData_POST_Overwrite(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8083", Handler: h}
@@ -650,10 +650,10 @@ func TestHandler_FormData_POST_Overwrite(t *testing.T) {
}
func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -662,13 +662,13 @@ func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8083", Handler: h}
@@ -722,10 +722,10 @@ func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
}
func TestHandler_FormData_PUT(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -734,13 +734,13 @@ func TestHandler_FormData_PUT(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":17834", Handler: h}
@@ -794,10 +794,10 @@ func TestHandler_FormData_PUT(t *testing.T) {
}
func TestHandler_FormData_PATCH(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -806,13 +806,13 @@ func TestHandler_FormData_PATCH(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8085", Handler: h}
@@ -866,10 +866,10 @@ func TestHandler_FormData_PATCH(t *testing.T) {
}
func TestHandler_Multipart_POST(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -878,13 +878,13 @@ func TestHandler_Multipart_POST(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8019", Handler: h}
@@ -980,10 +980,10 @@ func TestHandler_Multipart_POST(t *testing.T) {
}
func TestHandler_Multipart_PUT(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -992,13 +992,13 @@ func TestHandler_Multipart_PUT(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8020", Handler: h}
@@ -1094,10 +1094,10 @@ func TestHandler_Multipart_PUT(t *testing.T) {
}
func TestHandler_Multipart_PATCH(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "data", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1106,13 +1106,13 @@ func TestHandler_Multipart_PATCH(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8021", Handler: h}
@@ -1210,10 +1210,10 @@ func TestHandler_Multipart_PATCH(t *testing.T) {
}
func TestHandler_Error(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "error", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1222,13 +1222,13 @@ func TestHandler_Error(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1256,10 +1256,10 @@ func TestHandler_Error(t *testing.T) {
}
func TestHandler_Error2(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "error2", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1268,13 +1268,13 @@ func TestHandler_Error2(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1302,10 +1302,10 @@ func TestHandler_Error2(t *testing.T) {
}
func TestHandler_Error3(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "pid", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1314,13 +1314,13 @@ func TestHandler_Error3(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1361,10 +1361,10 @@ func TestHandler_Error3(t *testing.T) {
}
func TestHandler_ResponseDuration(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "echo", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1373,13 +1373,13 @@ func TestHandler_ResponseDuration(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1422,10 +1422,10 @@ func TestHandler_ResponseDuration(t *testing.T) {
}
func TestHandler_ResponseDurationDelayed(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "echoDelay", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1434,13 +1434,13 @@ func TestHandler_ResponseDurationDelayed(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1482,10 +1482,10 @@ func TestHandler_ResponseDurationDelayed(t *testing.T) {
}
func TestHandler_ErrorDuration(t *testing.T) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "error", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1494,13 +1494,13 @@ func TestHandler_ErrorDuration(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(t, err)
hs := &http.Server{Addr: ":8177", Handler: h}
@@ -1556,10 +1556,10 @@ func TestHandler_IP(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "ip", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1568,13 +1568,13 @@ func TestHandler_IP(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, cidrs, pool)
+ }, cidrs, p)
assert.NoError(t, err)
hs := &http.Server{Addr: "127.0.0.1:8177", Handler: h}
@@ -1617,10 +1617,10 @@ func TestHandler_XRealIP(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "ip", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1629,13 +1629,13 @@ func TestHandler_XRealIP(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, cidrs, pool)
+ }, cidrs, p)
assert.NoError(t, err)
hs := &http.Server{Addr: "127.0.0.1:8179", Handler: h}
@@ -1683,10 +1683,10 @@ func TestHandler_XForwardedFor(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "ip", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1695,13 +1695,13 @@ func TestHandler_XForwardedFor(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, cidrs, pool)
+ }, cidrs, p)
assert.NoError(t, err)
hs := &http.Server{Addr: "127.0.0.1:8177", Handler: h}
@@ -1748,10 +1748,10 @@ func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "ip", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1760,13 +1760,13 @@ func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) {
t.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, cidrs, pool)
+ }, cidrs, p)
assert.NoError(t, err)
hs := &http.Server{Addr: "127.0.0.1:8177", Handler: h}
@@ -1796,10 +1796,10 @@ func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) {
}
func BenchmarkHandler_Listen_Echo(b *testing.B) {
- pool, err := poolImpl.Initialize(context.Background(),
+ p, err := pool.Initialize(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../http/client.php", "echo", "pipes") },
pipe.NewPipeFactory(),
- poolImpl.Config{
+ pool.Config{
NumWorkers: int64(runtime.NumCPU()),
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1808,13 +1808,13 @@ func BenchmarkHandler_Listen_Echo(b *testing.B) {
b.Fatal(err)
}
defer func() {
- pool.Destroy(context.Background())
+ p.Destroy(context.Background())
}()
h, err := httpPlugin.NewHandler(1024, config.Uploads{
Dir: os.TempDir(),
Forbid: []string{},
- }, nil, pool)
+ }, nil, p)
assert.NoError(b, err)
hs := &http.Server{Addr: ":8177", Handler: h}
diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go
index c530f7d1..26b28165 100644
--- a/tests/plugins/http/http_plugin_test.go
+++ b/tests/plugins/http/http_plugin_test.go
@@ -19,7 +19,7 @@ import (
"github.com/golang/mock/gomock"
endure "github.com/spiral/endure/pkg/container"
goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc"
- "github.com/spiral/roadrunner/v2/interfaces/events"
+ "github.com/spiral/roadrunner/v2/pkg/events"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/informer"
"github.com/spiral/roadrunner/v2/plugins/logger"
diff --git a/tests/plugins/http/uploads_test.go b/tests/plugins/http/uploads_test.go
index e03638d2..dd986902 100644
--- a/tests/plugins/http/uploads_test.go
+++ b/tests/plugins/http/uploads_test.go
@@ -16,8 +16,8 @@ import (
"time"
j "github.com/json-iterator/go"
- "github.com/spiral/roadrunner/v2/pkg/pipe"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
+ "github.com/spiral/roadrunner/v2/pkg/transport/pipe"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/http/config"
"github.com/stretchr/testify/assert"
diff --git a/tests/plugins/informer/test_plugin.go b/tests/plugins/informer/test_plugin.go
index ba281d02..2e5af988 100644
--- a/tests/plugins/informer/test_plugin.go
+++ b/tests/plugins/informer/test_plugin.go
@@ -4,18 +4,18 @@ import (
"context"
"time"
- "github.com/spiral/roadrunner/v2/interfaces/worker"
- poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
+ "github.com/spiral/roadrunner/v2/pkg/pool"
+ "github.com/spiral/roadrunner/v2/pkg/worker"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/server"
)
-var testPoolConfig = poolImpl.Config{
+var testPoolConfig = pool.Config{
NumWorkers: 10,
MaxJobs: 100,
AllocateTimeout: time.Second * 10,
DestroyTimeout: time.Second * 10,
- Supervisor: &poolImpl.SupervisorConfig{
+ Supervisor: &pool.SupervisorConfig{
WatchTick: 60,
TTL: 1000,
IdleTTL: 10,
@@ -50,10 +50,16 @@ func (p1 *Plugin1) Name() string {
}
func (p1 *Plugin1) Workers() []worker.BaseProcess {
- pool, err := p1.server.NewWorkerPool(context.Background(), testPoolConfig, nil)
+ p, err := p1.server.NewWorkerPool(context.Background(), testPoolConfig, nil)
if err != nil {
panic(err)
}
- return pool.Workers()
+ workers := p.Workers()
+ baseWorkers := make([]worker.BaseProcess, 0, len(workers))
+ for i := 0; i < len(workers); i++ {
+ baseWorkers = append(baseWorkers, worker.FromSync(workers[i]))
+ }
+
+ return baseWorkers
}
diff --git a/tests/plugins/server/plugin_pipes.go b/tests/plugins/server/plugin_pipes.go
index 5eb2fed1..f53b228f 100644
--- a/tests/plugins/server/plugin_pipes.go
+++ b/tests/plugins/server/plugin_pipes.go
@@ -5,8 +5,8 @@ import (
"time"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/pool"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/worker"
"github.com/spiral/roadrunner/v2/plugins/config"
@@ -80,11 +80,7 @@ func (f *Foo) Serve() chan error {
}
// test that our worker is functional
- sw, err := worker.From(w)
- if err != nil {
- errCh <- err
- return errCh
- }
+ sw := worker.From(w)
rsp, err := sw.Exec(r)
if err != nil {
diff --git a/tests/plugins/server/plugin_sockets.go b/tests/plugins/server/plugin_sockets.go
index ede67ded..0b2857e3 100644
--- a/tests/plugins/server/plugin_sockets.go
+++ b/tests/plugins/server/plugin_sockets.go
@@ -4,8 +4,8 @@ import (
"context"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/worker"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/server"
@@ -60,11 +60,7 @@ func (f *Foo2) Serve() chan error {
}
// test that our worker is functional
- sw, err := worker.From(w)
- if err != nil {
- errCh <- err
- return errCh
- }
+ sw := worker.From(w)
rsp, err := sw.Exec(r)
if err != nil {
diff --git a/tests/plugins/server/plugin_tcp.go b/tests/plugins/server/plugin_tcp.go
index 98c13b2b..ef4cea39 100644
--- a/tests/plugins/server/plugin_tcp.go
+++ b/tests/plugins/server/plugin_tcp.go
@@ -4,8 +4,8 @@ import (
"context"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/worker"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/server"
@@ -60,11 +60,7 @@ func (f *Foo3) Serve() chan error {
}
// test that our worker is functional
- sw, err := worker.From(w)
- if err != nil {
- errCh <- err
- return errCh
- }
+ sw := worker.From(w)
rsp, err := sw.Exec(r)
if err != nil {