diff options
author | Valery Piashchynski <[email protected]> | 2021-01-25 13:10:06 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-25 13:10:06 +0300 |
commit | 2a0e7d37d825da6bb0538599ce0e2edaaa59403b (patch) | |
tree | 89c00a43333246bb6c6815c923548eecd7d4e717 /tests/plugins/resetter/resetter_test.go | |
parent | b18a3578b6d299aac5dfcc016c2a3a0f6905aa0d (diff) |
resolve #415
Diffstat (limited to 'tests/plugins/resetter/resetter_test.go')
-rw-r--r-- | tests/plugins/resetter/resetter_test.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/plugins/resetter/resetter_test.go b/tests/plugins/resetter/resetter_test.go index 6e206c7d..465d22dd 100644 --- a/tests/plugins/resetter/resetter_test.go +++ b/tests/plugins/resetter/resetter_test.go @@ -10,13 +10,14 @@ import ( "testing" "time" + "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/config" - "github.com/spiral/roadrunner/v2/plugins/logger" "github.com/spiral/roadrunner/v2/plugins/resetter" rpcPlugin "github.com/spiral/roadrunner/v2/plugins/rpc" "github.com/spiral/roadrunner/v2/plugins/server" + "github.com/spiral/roadrunner/v2/tests/mocks" "github.com/stretchr/testify/assert" ) @@ -31,10 +32,26 @@ func TestResetterInit(t *testing.T) { Prefix: "rr", } + controller := gomock.NewController(t) + mockLogger := mocks.NewMockLogger(controller) + + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("Started RPC service", "address", "tcp://127.0.0.1:6001", "services", []string{"resetter"}).MinTimes(1) + + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() + + mockLogger.EXPECT().Debug("started List method").MinTimes(1) + mockLogger.EXPECT().Debug("services list", "services", []string{"resetter.plugin1"}).MinTimes(1) + mockLogger.EXPECT().Debug("finished List method").MinTimes(1) + mockLogger.EXPECT().Debug("started Reset method for the service", "service", "resetter.plugin1").MinTimes(1) + mockLogger.EXPECT().Debug("finished Reset method for the service", "service", "resetter.plugin1").MinTimes(1) + mockLogger.EXPECT().Warn("listener accept error, connection closed", "error", gomock.Any()).AnyTimes() + err = cont.RegisterAll( cfg, &server.Plugin{}, - &logger.ZapLogger{}, + mockLogger, &resetter.Plugin{}, &rpcPlugin.Plugin{}, &Plugin1{}, |