summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-19 16:47:15 +0300
committerValery Piashchynski <[email protected]>2021-01-19 16:47:15 +0300
commit26f9d35e18ef79d79a5609c6c68f1b6ad38c7aed (patch)
treedd6224660ffd0dcefe2332807203ee1eaf6697b4 /tests
parent75ebbaac89ce8ebc3ab8de47b16e137844cfcd8a (diff)
Uniform all errors operations
Add new ExecTTL event Update tests Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/plugins/config/plugin1.go2
-rw-r--r--tests/plugins/gzip/plugin_test.go4
-rw-r--r--tests/plugins/http/http_plugin_test.go8
-rw-r--r--tests/plugins/reload/reload_plugin_test.go25
-rw-r--r--tests/plugins/static/static_plugin_test.go4
5 files changed, 24 insertions, 19 deletions
diff --git a/tests/plugins/config/plugin1.go b/tests/plugins/config/plugin1.go
index c77e7aa7..1de9a02e 100755
--- a/tests/plugins/config/plugin1.go
+++ b/tests/plugins/config/plugin1.go
@@ -62,7 +62,7 @@ func (f *Foo) Init(p config.Configurer) error {
}
func (f *Foo) Serve() chan error {
- const op = errors.Op("foo serve")
+ const op = errors.Op("foo_plugin_serve")
errCh := make(chan error, 1)
r := &ReloadConfig{}
diff --git a/tests/plugins/gzip/plugin_test.go b/tests/plugins/gzip/plugin_test.go
index b09d430e..9cf21b74 100644
--- a/tests/plugins/gzip/plugin_test.go
+++ b/tests/plugins/gzip/plugin_test.go
@@ -116,8 +116,8 @@ func TestMiddlewareNotExist(t *testing.T) {
mockLogger := mocks.NewMockLogger(controller)
mockLogger.EXPECT().Warn("requested middleware does not exist", "requested", "foo").AnyTimes()
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go
index 51bf7d0b..23628c72 100644
--- a/tests/plugins/http/http_plugin_test.go
+++ b/tests/plugins/http/http_plugin_test.go
@@ -1025,12 +1025,12 @@ logs:
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
- mockLogger.EXPECT().Info("worker destructed", "pid", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).MinTimes(1)
mockLogger.EXPECT().Debug("", "remote", gomock.Any(), "ts", gomock.Any(), "resp.status", gomock.Any(), "method", gomock.Any(), "uri", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Info("WORLD", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("WORLD", "pid", gomock.Any()).MinTimes(1)
mockLogger.EXPECT().Debug("worker event received", "event", events.EventWorkerLog, "worker state", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
diff --git a/tests/plugins/reload/reload_plugin_test.go b/tests/plugins/reload/reload_plugin_test.go
index c83d4787..81ac3c44 100644
--- a/tests/plugins/reload/reload_plugin_test.go
+++ b/tests/plugins/reload/reload_plugin_test.go
@@ -47,7 +47,8 @@ func TestReloadInit(t *testing.T) {
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker constructed", "pid", 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", "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)
@@ -55,7 +56,7 @@ func TestReloadInit(t *testing.T) {
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)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
@@ -140,7 +141,8 @@ func TestReloadHugeNumberOfFiles(t *testing.T) {
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes()
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)
@@ -150,7 +152,7 @@ func TestReloadHugeNumberOfFiles(t *testing.T) {
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)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
@@ -249,7 +251,8 @@ func TestReloadFilterFileExt(t *testing.T) {
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker constructed", "pid", 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(100)
mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
@@ -258,7 +261,7 @@ func TestReloadFilterFileExt(t *testing.T) {
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)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
@@ -376,7 +379,8 @@ func TestReloadCopy500(t *testing.T) {
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
//
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker constructed", "pid", 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(50)
mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50)
@@ -387,7 +391,7 @@ func TestReloadCopy500(t *testing.T) {
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)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
@@ -660,10 +664,11 @@ func TestReloadNoRecursion(t *testing.T) {
mockLogger := mocks.NewMockLogger(controller)
// http server should not be restarted. all event from wrong file extensions should be skipped
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).MinTimes(1)
mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1)
mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1)
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,
diff --git a/tests/plugins/static/static_plugin_test.go b/tests/plugins/static/static_plugin_test.go
index a411193d..d9829788 100644
--- a/tests/plugins/static/static_plugin_test.go
+++ b/tests/plugins/static/static_plugin_test.go
@@ -303,10 +303,10 @@ func TestStaticFilesForbid(t *testing.T) {
controller := gomock.NewController(t)
mockLogger := mocks.NewMockLogger(controller)
- mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes()
mockLogger.EXPECT().Debug("", "remote", gomock.Any(), "ts", gomock.Any(), "resp.status", gomock.Any(), "method", gomock.Any(), "uri", gomock.Any()).AnyTimes()
mockLogger.EXPECT().Error("file open error", "error", gomock.Any()).AnyTimes()
- mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
+ mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror
err = cont.RegisterAll(
cfg,