summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-25 14:46:01 +0300
committerValery Piashchynski <[email protected]>2020-12-25 14:46:01 +0300
commit8526c03822e724bc2ebb64b6197085fea335b782 (patch)
treeb205b392b3721606fae4fa3174327259b41bc76a /tests
parent42b33b77793789d666451798b07587f6404242b4 (diff)
Move root plugins to the pkg
Diffstat (limited to 'tests')
-rw-r--r--tests/mocks/mock_log.go150
-rw-r--r--tests/plugins/http/attributes_test.go2
-rw-r--r--tests/plugins/http/handler_test.go2
-rw-r--r--tests/plugins/http/http_test.go8
-rw-r--r--tests/plugins/http/parse_test.go2
-rw-r--r--tests/plugins/http/response_test.go2
-rw-r--r--tests/plugins/http/uploads_config_test.go2
-rw-r--r--tests/plugins/http/uploads_test.go2
-rw-r--r--tests/plugins/informer/informer_test.go4
-rw-r--r--tests/plugins/informer/test_plugin.go2
-rw-r--r--tests/plugins/server/plugin_pipes.go2
-rw-r--r--tests/plugins/server/plugin_sockets.go2
-rw-r--r--tests/plugins/server/plugin_tcp.go2
-rw-r--r--tests/plugins/server/server_test.go2
14 files changed, 167 insertions, 17 deletions
diff --git a/tests/mocks/mock_log.go b/tests/mocks/mock_log.go
new file mode 100644
index 00000000..8e3e2836
--- /dev/null
+++ b/tests/mocks/mock_log.go
@@ -0,0 +1,150 @@
+package mocks
+
+import (
+ "reflect"
+
+ "github.com/golang/mock/gomock"
+ "github.com/spiral/roadrunner-plugins/logger"
+)
+
+// MockLogger is a mock of Logger interface.
+type MockLogger struct {
+ ctrl *gomock.Controller
+ recorder *MockLoggerMockRecorder
+}
+
+// MockLoggerMockRecorder is the mock recorder for MockLogger.
+type MockLoggerMockRecorder struct {
+ mock *MockLogger
+}
+
+// NewMockLogger creates a new mock instance.
+func NewMockLogger(ctrl *gomock.Controller) *MockLogger {
+ mock := &MockLogger{ctrl: ctrl}
+ mock.recorder = &MockLoggerMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockLogger) EXPECT() *MockLoggerMockRecorder {
+ return m.recorder
+}
+
+func (m *MockLogger) Init() error {
+ mock := &MockLogger{ctrl: m.ctrl}
+ mock.recorder = &MockLoggerMockRecorder{mock}
+ return nil
+}
+
+// Debug mocks base method.
+func (m *MockLogger) Debug(msg string, keyvals ...interface{}) {
+ m.ctrl.T.Helper()
+ varargs := []interface{}{msg}
+ for _, a := range keyvals {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Debug", varargs...)
+}
+
+// Warn mocks base method.
+func (m *MockLogger) Warn(msg string, keyvals ...interface{}) {
+ m.ctrl.T.Helper()
+ varargs := []interface{}{msg}
+ for _, a := range keyvals {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Warn", varargs...)
+}
+
+// Info mocks base method.
+func (m *MockLogger) Info(msg string, keyvals ...interface{}) {
+ m.ctrl.T.Helper()
+ varargs := []interface{}{msg}
+ for _, a := range keyvals {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Info", varargs...)
+}
+
+// Error mocks base method.
+func (m *MockLogger) Error(msg string, keyvals ...interface{}) {
+ m.ctrl.T.Helper()
+ varargs := []interface{}{msg}
+ for _, a := range keyvals {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Error", varargs...)
+}
+
+// Warn indicates an expected call of Warn.
+func (mr *MockLoggerMockRecorder) Warn(msg interface{}, keyvals ...interface{}) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]interface{}{msg}, keyvals...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockLogger)(nil).Warn), varargs...)
+}
+
+// Debug indicates an expected call of Debug.
+func (mr *MockLoggerMockRecorder) Debug(msg interface{}, keyvals ...interface{}) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]interface{}{msg}, keyvals...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debug", reflect.TypeOf((*MockLogger)(nil).Debug), varargs...)
+}
+
+// Error indicates an expected call of Error.
+func (mr *MockLoggerMockRecorder) Error(msg interface{}, keyvals ...interface{}) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]interface{}{msg}, keyvals...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockLogger)(nil).Error), varargs...)
+}
+
+func (mr *MockLoggerMockRecorder) Init() error {
+ return nil
+}
+
+// Info indicates an expected call of Info.
+func (mr *MockLoggerMockRecorder) Info(msg interface{}, keyvals ...interface{}) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]interface{}{msg}, keyvals...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockLogger)(nil).Info), varargs...)
+}
+
+// MockWithLogger is a mock of WithLogger interface.
+type MockWithLogger struct {
+ ctrl *gomock.Controller
+ recorder *MockWithLoggerMockRecorder
+}
+
+// MockWithLoggerMockRecorder is the mock recorder for MockWithLogger.
+type MockWithLoggerMockRecorder struct {
+ mock *MockWithLogger
+}
+
+// NewMockWithLogger creates a new mock instance.
+func NewMockWithLogger(ctrl *gomock.Controller) *MockWithLogger {
+ mock := &MockWithLogger{ctrl: ctrl}
+ mock.recorder = &MockWithLoggerMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockWithLogger) EXPECT() *MockWithLoggerMockRecorder {
+ return m.recorder
+}
+
+// With mocks base method.
+func (m *MockWithLogger) With(keyvals ...interface{}) logger.Logger {
+ m.ctrl.T.Helper()
+ varargs := []interface{}{}
+ for _, a := range keyvals {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "With", varargs...)
+ ret0, _ := ret[0].(logger.Logger)
+ return ret0
+}
+
+// With indicates an expected call of With.
+func (mr *MockWithLoggerMockRecorder) With(keyvals ...interface{}) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "With", reflect.TypeOf((*MockWithLogger)(nil).With), keyvals...)
+}
diff --git a/tests/plugins/http/attributes_test.go b/tests/plugins/http/attributes_test.go
index 69200a30..54998906 100644
--- a/tests/plugins/http/attributes_test.go
+++ b/tests/plugins/http/attributes_test.go
@@ -4,7 +4,7 @@ import (
"net/http"
"testing"
- "github.com/spiral/roadrunner/v2/plugins/http/attributes"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/http/attributes"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/handler_test.go b/tests/plugins/http/handler_test.go
index 18558296..193bf0cf 100644
--- a/tests/plugins/http/handler_test.go
+++ b/tests/plugins/http/handler_test.go
@@ -11,8 +11,8 @@ import (
"strings"
"github.com/spiral/roadrunner/v2/pkg/pipe"
+ httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
"net/http"
diff --git a/tests/plugins/http/http_test.go b/tests/plugins/http/http_test.go
index 9c081bc5..f4a357f2 100644
--- a/tests/plugins/http/http_test.go
+++ b/tests/plugins/http/http_test.go
@@ -23,14 +23,14 @@ import (
"github.com/spiral/roadrunner-plugins/logger"
"github.com/spiral/roadrunner-plugins/resetter"
"github.com/spiral/roadrunner/v2/interfaces/events"
- "github.com/spiral/roadrunner/v2/mocks"
- "github.com/spiral/roadrunner/v2/plugins/informer"
- "github.com/spiral/roadrunner/v2/plugins/server"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/informer"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
+ "github.com/spiral/roadrunner/v2/tests/mocks"
"github.com/spiral/roadrunner/v2/tools"
"github.com/yookoala/gofast"
rpcPlugin "github.com/spiral/roadrunner-plugins/rpc"
- httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/parse_test.go b/tests/plugins/http/parse_test.go
index 5cc1ce32..df217202 100644
--- a/tests/plugins/http/parse_test.go
+++ b/tests/plugins/http/parse_test.go
@@ -3,7 +3,7 @@ package http
import (
"testing"
- "github.com/spiral/roadrunner/v2/plugins/http"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/http"
)
var samples = []struct {
diff --git a/tests/plugins/http/response_test.go b/tests/plugins/http/response_test.go
index a9cbf91a..229163a2 100644
--- a/tests/plugins/http/response_test.go
+++ b/tests/plugins/http/response_test.go
@@ -7,7 +7,7 @@ import (
"testing"
"github.com/spiral/roadrunner/v2/pkg/payload"
- httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/uploads_config_test.go b/tests/plugins/http/uploads_config_test.go
index e76078ee..4a7927c5 100644
--- a/tests/plugins/http/uploads_config_test.go
+++ b/tests/plugins/http/uploads_config_test.go
@@ -4,7 +4,7 @@ import (
"os"
"testing"
- httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/uploads_test.go b/tests/plugins/http/uploads_test.go
index 7bb25cbf..e71ff8c1 100644
--- a/tests/plugins/http/uploads_test.go
+++ b/tests/plugins/http/uploads_test.go
@@ -17,8 +17,8 @@ import (
j "github.com/json-iterator/go"
"github.com/spiral/roadrunner/v2/pkg/pipe"
+ httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/informer/informer_test.go b/tests/plugins/informer/informer_test.go
index 97f27671..15063d7e 100644
--- a/tests/plugins/informer/informer_test.go
+++ b/tests/plugins/informer/informer_test.go
@@ -14,8 +14,8 @@ import (
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner-plugins/logger"
rpcPlugin "github.com/spiral/roadrunner-plugins/rpc"
- "github.com/spiral/roadrunner/v2/plugins/informer"
- "github.com/spiral/roadrunner/v2/plugins/server"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/informer"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
"github.com/spiral/roadrunner/v2/tools"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/informer/test_plugin.go b/tests/plugins/informer/test_plugin.go
index ab3b2286..95adfb07 100644
--- a/tests/plugins/informer/test_plugin.go
+++ b/tests/plugins/informer/test_plugin.go
@@ -6,8 +6,8 @@ import (
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner/v2/interfaces/worker"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
- "github.com/spiral/roadrunner/v2/plugins/server"
)
var testPoolConfig = poolImpl.Config{
diff --git a/tests/plugins/server/plugin_pipes.go b/tests/plugins/server/plugin_pipes.go
index afed695f..6f31395a 100644
--- a/tests/plugins/server/plugin_pipes.go
+++ b/tests/plugins/server/plugin_pipes.go
@@ -8,9 +8,9 @@ import (
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/server"
)
const ConfigSection = "server"
diff --git a/tests/plugins/server/plugin_sockets.go b/tests/plugins/server/plugin_sockets.go
index f5f8f7ad..1820b4c1 100644
--- a/tests/plugins/server/plugin_sockets.go
+++ b/tests/plugins/server/plugin_sockets.go
@@ -7,8 +7,8 @@ import (
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/server"
)
type Foo2 struct {
diff --git a/tests/plugins/server/plugin_tcp.go b/tests/plugins/server/plugin_tcp.go
index 2f33659c..01fa0cf5 100644
--- a/tests/plugins/server/plugin_tcp.go
+++ b/tests/plugins/server/plugin_tcp.go
@@ -7,8 +7,8 @@ import (
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner/v2/interfaces/pool"
"github.com/spiral/roadrunner/v2/pkg/payload"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
"github.com/spiral/roadrunner/v2/pkg/worker"
- "github.com/spiral/roadrunner/v2/plugins/server"
)
type Foo3 struct {
diff --git a/tests/plugins/server/server_test.go b/tests/plugins/server/server_test.go
index 5be25a20..75111ef7 100644
--- a/tests/plugins/server/server_test.go
+++ b/tests/plugins/server/server_test.go
@@ -9,7 +9,7 @@ import (
"github.com/spiral/endure"
"github.com/spiral/roadrunner-plugins/config"
"github.com/spiral/roadrunner-plugins/logger"
- "github.com/spiral/roadrunner/v2/plugins/server"
+ "github.com/spiral/roadrunner/v2/pkg/plugins/server"
"github.com/stretchr/testify/assert"
)