summaryrefslogtreecommitdiff
path: root/plugins/reload
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-16 19:10:46 +0300
committerValery Piashchynski <[email protected]>2020-12-16 19:10:46 +0300
commit9f482c58d5a0a89e5e0d9f34bf063c519ee60cb5 (patch)
treea5349d77eb05bdf97ec6394e6414abadc8cd22df /plugins/reload
parenteaa8310137634b85d880b914a3510f39ccd16b6a (diff)
Remove mocked logger
Diffstat (limited to 'plugins/reload')
-rw-r--r--plugins/reload/tests/reload_plugin_test.go114
1 files changed, 58 insertions, 56 deletions
diff --git a/plugins/reload/tests/reload_plugin_test.go b/plugins/reload/tests/reload_plugin_test.go
index 1cb506e0..b57bdefa 100644
--- a/plugins/reload/tests/reload_plugin_test.go
+++ b/plugins/reload/tests/reload_plugin_test.go
@@ -20,6 +20,7 @@ import (
"github.com/spiral/roadrunner/v2/mocks"
"github.com/spiral/roadrunner/v2/plugins/config"
httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
+ "github.com/spiral/roadrunner/v2/plugins/logger"
"github.com/spiral/roadrunner/v2/plugins/reload"
"github.com/spiral/roadrunner/v2/plugins/resetter"
"github.com/spiral/roadrunner/v2/plugins/server"
@@ -48,20 +49,20 @@ func TestReloadInit(t *testing.T) {
assert.NoError(t, freeResources(testDir))
}()
- controller := gomock.NewController(t)
- mockLogger := mocks.NewMockLogger(controller)
-
- mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
- mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2)
- mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2)
- mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").Times(1)
- mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1)
- mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1)
- mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1)
+ //controller := gomock.NewController(t)
+ //mockLogger := mocks.NewMockLogger(controller)
+ //
+ //mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
+ //mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2)
+ //mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2)
+ //mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").Times(1)
+ //mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1)
+ //mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1)
+ //mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1)
err = cont.RegisterAll(
cfg,
- mockLogger,
+ &logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
&reload.Plugin{},
@@ -146,22 +147,23 @@ func TestReloadHugeNumberOfFiles(t *testing.T) {
assert.NoError(t, freeResources(testCopyToDir))
}()
- controller := gomock.NewController(t)
- mockLogger := mocks.NewMockLogger(controller)
-
- mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).AnyTimes()
- mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
- mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Debug("file was updated", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1)
+ //controller := gomock.NewController(t)
+ //mockLogger := mocks.NewMockLogger(controller)
+ //
+ //mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).AnyTimes()
+ //mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
+ //mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
+ //mockLogger.EXPECT().Debug("file was updated", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
+ //mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
+ //mockLogger.EXPECT().Debug("file was removed from watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1)
err = cont.RegisterAll(
cfg,
- mockLogger,
+ &logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
&reload.Plugin{},
@@ -261,21 +263,21 @@ func TestReloadFilterFileExt(t *testing.T) {
assert.NoError(t, freeResources(testDir))
}()
- controller := gomock.NewController(t)
- mockLogger := mocks.NewMockLogger(controller)
-
- mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
- mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(100)
- mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).AnyTimes()
- mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").Times(1)
- mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1)
- mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1)
- mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1)
+ //controller := gomock.NewController(t)
+ //mockLogger := mocks.NewMockLogger(controller)
+ //
+ //mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
+ //mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(100)
+ //mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
+ //mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).AnyTimes()
+ //mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").Times(1)
+ //mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1)
+ //mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1)
+ //mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1)
err = cont.RegisterAll(
cfg,
- mockLogger,
+ &logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
&reload.Plugin{},
@@ -399,23 +401,23 @@ func TestReloadCopy3k(t *testing.T) {
assert.NoError(t, freeResources("dir1"))
}()
- controller := gomock.NewController(t)
- mockLogger := mocks.NewMockLogger(controller)
- //
- mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
- mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
- mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
- mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
- mockLogger.EXPECT().Debug("file was removed from watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
- mockLogger.EXPECT().Debug("file was updated", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
- mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1)
- mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1)
+ //controller := gomock.NewController(t)
+ //mockLogger := mocks.NewMockLogger(controller)
+ ////
+ //mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
+ //mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
+ //mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
+ //mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
+ //mockLogger.EXPECT().Debug("file was removed from watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
+ //mockLogger.EXPECT().Debug("file was updated", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
+ //mockLogger.EXPECT().Info("HTTP plugin got restart request. Restarting...").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1)
+ //mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1)
err = cont.RegisterAll(
cfg,
- mockLogger,
+ &logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
&reload.Plugin{},
@@ -694,15 +696,15 @@ func TestReloadNoRecursion(t *testing.T) {
assert.NoError(t, freeResources("dir1"))
}()
- controller := gomock.NewController(t)
- mockLogger := mocks.NewMockLogger(controller)
-
- // http server should not be restarted. all event from wrong file extensions should be skipped
- mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
+ //controller := gomock.NewController(t)
+ //mockLogger := mocks.NewMockLogger(controller)
+ //
+ //http server should not be restarted. all event from wrong file extensions should be skipped
+ //mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
err = cont.RegisterAll(
cfg,
- mockLogger,
+ &logger.ZapLogger{},
&server.Plugin{},
&httpPlugin.Plugin{},
&reload.Plugin{},