diff options
Diffstat (limited to 'plugin/rpcplugin/main_test.go')
-rw-r--r-- | plugin/rpcplugin/main_test.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugin/rpcplugin/main_test.go b/plugin/rpcplugin/main_test.go index 6cdd46df0..06423106c 100644 --- a/plugin/rpcplugin/main_test.go +++ b/plugin/rpcplugin/main_test.go @@ -10,11 +10,21 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/plugin/plugintest" "github.com/mattermost/mattermost-server/plugin/rpcplugin/rpcplugintest" ) func TestMain(t *testing.T) { + // Setup a global logger to catch tests logging outside of app context + // The global logger will be stomped by apps initalizing but that's fine for testing. Ideally this won't happen. + mlog.InitGlobalLogger(mlog.NewLogger(&mlog.LoggerConfiguration{ + EnableConsole: true, + ConsoleJson: true, + ConsoleLevel: "error", + EnableFile: false, + })) + dir, err := ioutil.TempDir("", "") require.NoError(t, err) defer os.RemoveAll(dir) @@ -46,7 +56,7 @@ func TestMain(t *testing.T) { var api plugintest.API - hooks, err := ConnectMain(muxer) + hooks, err := ConnectMain(muxer, "plugin_id") require.NoError(t, err) assert.NoError(t, hooks.OnActivate(&api)) assert.NoError(t, hooks.OnDeactivate()) |