summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-31 16:05:00 +0300
committerValery Piashchynski <[email protected]>2021-05-31 16:05:00 +0300
commit49703d70a3ede70ce9a0cab824cbcb96dbf824c0 (patch)
tree181d72a3321d52c960a519ba3a233e3e7fe8e86a /tests
parent0ee91dc24d3e68706d89092c06b1c0d09dab0353 (diff)
- Rework access_validators
- WS plugin uses it's own pool to handle requests on the /ws (or any user-defined) endpoint - Ability to write custom validators Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/plugins/config/config_test.go15
-rw-r--r--tests/plugins/gzip/plugin_test.go3
-rw-r--r--tests/plugins/headers/headers_plugin_test.go5
-rw-r--r--tests/plugins/http/http_plugin_test.go22
-rw-r--r--tests/plugins/logger/logger_test.go3
-rw-r--r--tests/plugins/metrics/metrics_test.go2
-rw-r--r--tests/plugins/reload/reload_plugin_test.go6
-rw-r--r--tests/plugins/status/plugin_test.go5
-rw-r--r--tests/plugins/websockets/websocket_plugin_test.go7
9 files changed, 3 insertions, 65 deletions
diff --git a/tests/plugins/config/config_test.go b/tests/plugins/config/config_test.go
index 3cf026bd..b6063cec 100755
--- a/tests/plugins/config/config_test.go
+++ b/tests/plugins/config/config_test.go
@@ -7,7 +7,6 @@ import (
"time"
endure "github.com/spiral/endure/pkg/container"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/logger"
"github.com/spiral/roadrunner/v2/plugins/rpc"
@@ -34,11 +33,6 @@ func TestViperProvider_Init(t *testing.T) {
t.Fatal(err)
}
- err = container.Register(&channel.Plugin{})
- if err != nil {
- t.Fatal(err)
- }
-
err = container.Init()
if err != nil {
t.Fatal(err)
@@ -88,7 +82,6 @@ func TestConfigOverwriteFail(t *testing.T) {
&rpc.Plugin{},
vp,
&Foo2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -110,7 +103,6 @@ func TestConfigOverwriteValid(t *testing.T) {
&logger.ZapLogger{},
&rpc.Plugin{},
vp,
- &channel.Plugin{},
&Foo2{},
)
assert.NoError(t, err)
@@ -163,7 +155,6 @@ func TestConfigEnvVariables(t *testing.T) {
&rpc.Plugin{},
vp,
&Foo2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -215,7 +206,6 @@ func TestConfigEnvVariablesFail(t *testing.T) {
&rpc.Plugin{},
vp,
&Foo2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -247,11 +237,6 @@ func TestConfigProvider_GeneralSection(t *testing.T) {
t.Fatal(err)
}
- err = container.Register(&channel.Plugin{})
- if err != nil {
- t.Fatal(err)
- }
-
err = container.Init()
if err != nil {
t.Fatal(err)
diff --git a/tests/plugins/gzip/plugin_test.go b/tests/plugins/gzip/plugin_test.go
index 5294e672..844fd411 100644
--- a/tests/plugins/gzip/plugin_test.go
+++ b/tests/plugins/gzip/plugin_test.go
@@ -11,7 +11,6 @@ import (
"github.com/golang/mock/gomock"
endure "github.com/spiral/endure/pkg/container"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/gzip"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
@@ -36,7 +35,6 @@ func TestGzipPlugin(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&gzip.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -130,7 +128,6 @@ func TestMiddlewareNotExist(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&gzip.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/headers/headers_plugin_test.go b/tests/plugins/headers/headers_plugin_test.go
index e4903335..49d86b00 100644
--- a/tests/plugins/headers/headers_plugin_test.go
+++ b/tests/plugins/headers/headers_plugin_test.go
@@ -11,7 +11,6 @@ import (
"time"
endure "github.com/spiral/endure/pkg/container"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/headers"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
@@ -35,7 +34,6 @@ func TestHeadersInit(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&headers.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -102,7 +100,6 @@ func TestRequestHeaders(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&headers.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -188,7 +185,6 @@ func TestResponseHeaders(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&headers.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -275,7 +271,6 @@ func TestCORSHeaders(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&headers.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go
index aa57077d..128eec26 100644
--- a/tests/plugins/http/http_plugin_test.go
+++ b/tests/plugins/http/http_plugin_test.go
@@ -24,7 +24,6 @@ import (
goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc"
"github.com/spiral/roadrunner/v2/pkg/events"
"github.com/spiral/roadrunner/v2/pkg/process"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/gzip"
"github.com/spiral/roadrunner/v2/plugins/informer"
@@ -63,7 +62,6 @@ func TestHTTPInit(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -128,7 +126,6 @@ func TestHTTPNoConfigSection(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -196,7 +193,6 @@ func TestHTTPInformerReset(t *testing.T) {
&httpPlugin.Plugin{},
&informer.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -319,7 +315,6 @@ func TestSSL(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -456,7 +451,6 @@ func TestSSLRedirect(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -546,7 +540,6 @@ func TestSSLPushPipes(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -637,7 +630,6 @@ func TestFastCGI_RequestUri(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -732,7 +724,6 @@ func TestH2CUpgrade(t *testing.T) {
mockLogger,
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -824,7 +815,6 @@ func TestH2C(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -917,7 +907,6 @@ func TestHttpMiddleware(t *testing.T) {
&httpPlugin.Plugin{},
&PluginMiddleware{},
&PluginMiddleware2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1064,7 +1053,6 @@ logs:
&httpPlugin.Plugin{},
&PluginMiddleware{},
&PluginMiddleware2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1150,7 +1138,6 @@ func TestHttpEnvVariables(t *testing.T) {
&httpPlugin.Plugin{},
&PluginMiddleware{},
&PluginMiddleware2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1238,7 +1225,6 @@ func TestHttpBrokenPipes(t *testing.T) {
&httpPlugin.Plugin{},
&PluginMiddleware{},
&PluginMiddleware2{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1300,7 +1286,6 @@ func TestHTTPSupervisedPool(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&informer.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1503,7 +1488,6 @@ func TestHTTPBigRequestSize(t *testing.T) {
&logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1596,7 +1580,6 @@ func TestStaticEtagPlugin(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1695,7 +1678,6 @@ func TestStaticPluginSecurity(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1845,7 +1827,6 @@ func TestStaticPlugin(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -1960,7 +1941,6 @@ func TestStaticDisabled_Error(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
assert.Error(t, cont.Init())
@@ -1982,7 +1962,6 @@ func TestStaticFilesDisabled(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -2075,7 +2054,6 @@ func TestStaticFilesForbid(t *testing.T) {
&httpPlugin.Plugin{},
&gzip.Plugin{},
&static.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/logger/logger_test.go b/tests/plugins/logger/logger_test.go
index f63a6a5d..d2877781 100644
--- a/tests/plugins/logger/logger_test.go
+++ b/tests/plugins/logger/logger_test.go
@@ -9,7 +9,6 @@ import (
"github.com/golang/mock/gomock"
endure "github.com/spiral/endure/pkg/container"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/logger"
@@ -99,7 +98,6 @@ func TestLoggerRawErr(t *testing.T) {
mockLogger,
&server.Plugin{},
&http.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -226,7 +224,6 @@ func TestLoggerNoConfig2(t *testing.T) {
&logger.ZapLogger{},
&http.Plugin{},
&server.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/metrics/metrics_test.go b/tests/plugins/metrics/metrics_test.go
index 48c01f24..8be567ec 100644
--- a/tests/plugins/metrics/metrics_test.go
+++ b/tests/plugins/metrics/metrics_test.go
@@ -15,7 +15,6 @@ 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/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/logger"
@@ -145,7 +144,6 @@ func TestMetricsIssue571(t *testing.T) {
&server.Plugin{},
mockLogger,
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/reload/reload_plugin_test.go b/tests/plugins/reload/reload_plugin_test.go
index 41c9c92f..6db7b6d0 100644
--- a/tests/plugins/reload/reload_plugin_test.go
+++ b/tests/plugins/reload/reload_plugin_test.go
@@ -16,7 +16,6 @@ import (
"github.com/golang/mock/gomock"
endure "github.com/spiral/endure/pkg/container"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/reload"
@@ -66,7 +65,6 @@ func TestReloadInit(t *testing.T) {
&httpPlugin.Plugin{},
&reload.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -163,7 +161,6 @@ func TestReloadHugeNumberOfFiles(t *testing.T) {
&httpPlugin.Plugin{},
&reload.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -273,7 +270,6 @@ func TestReloadFilterFileExt(t *testing.T) {
&httpPlugin.Plugin{},
&reload.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -404,7 +400,6 @@ func TestReloadCopy100(t *testing.T) {
&httpPlugin.Plugin{},
&reload.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -682,7 +677,6 @@ func TestReloadNoRecursion(t *testing.T) {
&httpPlugin.Plugin{},
&reload.Plugin{},
&resetter.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/status/plugin_test.go b/tests/plugins/status/plugin_test.go
index 06983199..663f4ee3 100644
--- a/tests/plugins/status/plugin_test.go
+++ b/tests/plugins/status/plugin_test.go
@@ -14,7 +14,6 @@ import (
endure "github.com/spiral/endure/pkg/container"
goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/logger"
@@ -39,7 +38,6 @@ func TestStatusHttp(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&status.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -127,7 +125,6 @@ func TestStatusRPC(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&status.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -207,7 +204,6 @@ func TestReadyHttp(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&status.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -295,7 +291,6 @@ func TestReadinessRPCWorkerNotReady(t *testing.T) {
&server.Plugin{},
&httpPlugin.Plugin{},
&status.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
diff --git a/tests/plugins/websockets/websocket_plugin_test.go b/tests/plugins/websockets/websocket_plugin_test.go
index 61ef186b..6b11f9e1 100644
--- a/tests/plugins/websockets/websocket_plugin_test.go
+++ b/tests/plugins/websockets/websocket_plugin_test.go
@@ -16,7 +16,6 @@ import (
json "github.com/json-iterator/go"
endure "github.com/spiral/endure/pkg/container"
goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc"
- "github.com/spiral/roadrunner/v2/plugins/channel"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/spiral/roadrunner/v2/plugins/logger"
@@ -60,7 +59,6 @@ func TestBroadcastInit(t *testing.T) {
&redis.Plugin{},
&websockets.Plugin{},
&httpPlugin.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -170,7 +168,6 @@ func TestWSRedisAndMemory(t *testing.T) {
&websockets.Plugin{},
&httpPlugin.Plugin{},
&memory.Plugin{},
- &channel.Plugin{},
)
assert.NoError(t, err)
@@ -313,7 +310,9 @@ func RPCWsMemory(t *testing.T) {
assert.NoError(t, err)
defer func() {
- _ = resp.Body.Close()
+ if resp != nil && resp.Body != nil {
+ _ = resp.Body.Close()
+ }
}()
d, err := json.Marshal(message("join", "memory", []byte("hello websockets"), "foo", "foo2"))