summaryrefslogtreecommitdiff
path: root/plugins/http/tests
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/http/tests')
-rw-r--r--plugins/http/tests/configs/.rr-http.yaml13
-rw-r--r--plugins/http/tests/handler_test.go165
-rw-r--r--plugins/http/tests/http_test.go5
-rw-r--r--plugins/http/tests/response_test.go16
-rw-r--r--plugins/http/tests/uploads_test.go27
5 files changed, 108 insertions, 118 deletions
diff --git a/plugins/http/tests/configs/.rr-http.yaml b/plugins/http/tests/configs/.rr-http.yaml
index c6868f8c..e2e361cf 100644
--- a/plugins/http/tests/configs/.rr-http.yaml
+++ b/plugins/http/tests/configs/.rr-http.yaml
@@ -24,19 +24,6 @@ http:
maxJobs: 0
allocateTimeout: 60s
destroyTimeout: 60s
-
- ssl:
- port: 8892
- redirect: false
- cert: fixtures/server.crt
- key: fixtures/server.key
- # rootCa: root.crt
- fcgi:
- address: tcp://0.0.0.0:7921
- http2:
- enabled: false
- h2c: false
- maxConcurrentStreams: 128
logs:
mode: development
level: error
diff --git a/plugins/http/tests/handler_test.go b/plugins/http/tests/handler_test.go
index 0c6a39ef..54a4ae80 100644
--- a/plugins/http/tests/handler_test.go
+++ b/plugins/http/tests/handler_test.go
@@ -10,7 +10,8 @@ import (
"runtime"
"strings"
- "github.com/spiral/roadrunner/v2"
+ "github.com/spiral/roadrunner/v2/pkg/pipe"
+ poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
@@ -21,10 +22,10 @@ import (
)
func TestHandler_Echo(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "echo", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -72,10 +73,10 @@ func Test_HandlerErrors(t *testing.T) {
}
func TestHandler_Headers(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "header", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -133,10 +134,10 @@ func TestHandler_Headers(t *testing.T) {
}
func TestHandler_Empty_User_Agent(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "user-agent", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -193,10 +194,10 @@ func TestHandler_Empty_User_Agent(t *testing.T) {
}
func TestHandler_User_Agent(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "user-agent", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -253,10 +254,10 @@ func TestHandler_User_Agent(t *testing.T) {
}
func TestHandler_Cookies(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "cookie", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -318,10 +319,10 @@ func TestHandler_Cookies(t *testing.T) {
}
func TestHandler_JsonPayload_POST(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "payload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -382,10 +383,10 @@ func TestHandler_JsonPayload_POST(t *testing.T) {
}
func TestHandler_JsonPayload_PUT(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "payload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -442,10 +443,10 @@ func TestHandler_JsonPayload_PUT(t *testing.T) {
}
func TestHandler_JsonPayload_PATCH(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "payload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -502,10 +503,10 @@ func TestHandler_JsonPayload_PATCH(t *testing.T) {
}
func TestHandler_FormData_POST(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -575,10 +576,10 @@ func TestHandler_FormData_POST(t *testing.T) {
}
func TestHandler_FormData_POST_Overwrite(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -648,10 +649,10 @@ func TestHandler_FormData_POST_Overwrite(t *testing.T) {
}
func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -720,10 +721,10 @@ func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
}
func TestHandler_FormData_PUT(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -792,10 +793,10 @@ func TestHandler_FormData_PUT(t *testing.T) {
}
func TestHandler_FormData_PATCH(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -864,10 +865,10 @@ func TestHandler_FormData_PATCH(t *testing.T) {
}
func TestHandler_Multipart_POST(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -978,10 +979,10 @@ func TestHandler_Multipart_POST(t *testing.T) {
}
func TestHandler_Multipart_PUT(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1092,10 +1093,10 @@ func TestHandler_Multipart_PUT(t *testing.T) {
}
func TestHandler_Multipart_PATCH(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "data", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1208,10 +1209,10 @@ func TestHandler_Multipart_PATCH(t *testing.T) {
}
func TestHandler_Error(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "error", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1254,10 +1255,10 @@ func TestHandler_Error(t *testing.T) {
}
func TestHandler_Error2(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "error2", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1300,10 +1301,10 @@ func TestHandler_Error2(t *testing.T) {
}
func TestHandler_Error3(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "pid", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1359,10 +1360,10 @@ func TestHandler_Error3(t *testing.T) {
}
func TestHandler_ResponseDuration(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "echo", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1420,10 +1421,10 @@ func TestHandler_ResponseDuration(t *testing.T) {
}
func TestHandler_ResponseDurationDelayed(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "echoDelay", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1480,10 +1481,10 @@ func TestHandler_ResponseDurationDelayed(t *testing.T) {
}
func TestHandler_ErrorDuration(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "error", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1554,10 +1555,10 @@ func TestHandler_IP(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "ip", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1615,10 +1616,10 @@ func TestHandler_XRealIP(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "ip", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1681,10 +1682,10 @@ func TestHandler_XForwardedFor(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "ip", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1746,10 +1747,10 @@ func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cidrs)
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "ip", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -1794,10 +1795,10 @@ func TestHandler_XForwardedFor_NotTrustedRemoteIp(t *testing.T) {
}
func BenchmarkHandler_Listen_Echo(b *testing.B) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "echo", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: int64(runtime.NumCPU()),
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
diff --git a/plugins/http/tests/http_test.go b/plugins/http/tests/http_test.go
index c8dd4b38..1a61597c 100644
--- a/plugins/http/tests/http_test.go
+++ b/plugins/http/tests/http_test.go
@@ -19,6 +19,7 @@ import (
"github.com/spiral/endure"
"github.com/spiral/goridge/v3"
"github.com/spiral/roadrunner/v2"
+ "github.com/spiral/roadrunner/v2/interfaces/events"
"github.com/spiral/roadrunner/v2/mocks"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
@@ -821,7 +822,7 @@ func TestHttpMiddleware(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 15)
+ tt := time.NewTimer(time.Second * 20)
go func() {
defer wg.Done()
@@ -900,7 +901,7 @@ func TestHttpEchoErr(t *testing.T) {
mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1")
mockLogger.EXPECT().Debug("WORLD", "pid", gomock.Any())
- mockLogger.EXPECT().Debug("worker event received", "event", roadrunner.EventWorkerLog, "worker state", gomock.Any())
+ mockLogger.EXPECT().Debug("worker event received", "event", events.EventWorkerLog, "worker state", gomock.Any())
err = cont.RegisterAll(
cfg,
diff --git a/plugins/http/tests/response_test.go b/plugins/http/tests/response_test.go
index 2bfe7d56..a526fe03 100644
--- a/plugins/http/tests/response_test.go
+++ b/plugins/http/tests/response_test.go
@@ -6,7 +6,7 @@ import (
"net/http"
"testing"
- "github.com/spiral/roadrunner/v2"
+ "github.com/spiral/roadrunner/v2/internal"
http2 "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)
@@ -45,13 +45,13 @@ func (tw *testWriter) Push(target string, opts *http.PushOptions) error {
}
func TestNewResponse_Error(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{Context: []byte(`invalid payload`)})
+ r, err := http2.NewResponse(internal.Payload{Context: []byte(`invalid payload`)})
assert.Error(t, err)
assert.Nil(t, r)
}
func TestNewResponse_Write(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(`{"headers":{"key":["value"]},"status": 301}`),
Body: []byte(`sample body`),
})
@@ -68,7 +68,7 @@ func TestNewResponse_Write(t *testing.T) {
}
func TestNewResponse_Stream(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(`{"headers":{"key":["value"]},"status": 301}`),
})
@@ -92,7 +92,7 @@ func TestNewResponse_Stream(t *testing.T) {
}
func TestNewResponse_StreamError(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(`{"headers":{"key":["value"]},"status": 301}`),
})
@@ -112,7 +112,7 @@ func TestNewResponse_StreamError(t *testing.T) {
}
func TestWrite_HandlesPush(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(`{"headers":{"Http2-Push":["/test.js"],"content-type":["text/html"]},"status": 200}`),
})
@@ -127,7 +127,7 @@ func TestWrite_HandlesPush(t *testing.T) {
}
func TestWrite_HandlesTrailers(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(`{"headers":{"Trailer":["foo, bar", "baz"],"foo":["test"],"bar":["demo"]},"status": 200}`),
})
@@ -146,7 +146,7 @@ func TestWrite_HandlesTrailers(t *testing.T) {
}
func TestWrite_HandlesHandlesWhitespacesInTrailer(t *testing.T) {
- r, err := http2.NewResponse(roadrunner.Payload{
+ r, err := http2.NewResponse(internal.Payload{
Context: []byte(
`{"headers":{"Trailer":["foo\t,bar , baz"],"foo":["a"],"bar":["b"],"baz":["c"]},"status": 200}`),
})
diff --git a/plugins/http/tests/uploads_test.go b/plugins/http/tests/uploads_test.go
index d36d4793..f255ec91 100644
--- a/plugins/http/tests/uploads_test.go
+++ b/plugins/http/tests/uploads_test.go
@@ -16,7 +16,8 @@ import (
"time"
j "github.com/json-iterator/go"
- "github.com/spiral/roadrunner/v2"
+ "github.com/spiral/roadrunner/v2/pkg/pipe"
+ poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)
@@ -26,10 +27,10 @@ var json = j.ConfigCompatibleWithStandardLibrary
const testFile = "uploads_test.go"
func TestHandler_Upload_File(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "upload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -109,10 +110,10 @@ func TestHandler_Upload_File(t *testing.T) {
}
func TestHandler_Upload_NestedFile(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "upload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -192,10 +193,10 @@ func TestHandler_Upload_NestedFile(t *testing.T) {
}
func TestHandler_Upload_File_NoTmpDir(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "upload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,
@@ -275,10 +276,10 @@ func TestHandler_Upload_File_NoTmpDir(t *testing.T) {
}
func TestHandler_Upload_File_Forbids(t *testing.T) {
- pool, err := roadrunner.NewPool(context.Background(),
+ pool, err := poolImpl.NewPool(context.Background(),
func() *exec.Cmd { return exec.Command("php", "../../../tests/http/client.php", "upload", "pipes") },
- roadrunner.NewPipeFactory(),
- roadrunner.PoolConfig{
+ pipe.NewPipeFactory(),
+ poolImpl.Config{
NumWorkers: 1,
AllocateTimeout: time.Second * 1000,
DestroyTimeout: time.Second * 1000,