summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/main_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-06-25 12:33:13 -0700
committerGitHub <noreply@github.com>2018-06-25 12:33:13 -0700
commit1e5c432e1029601a664454388ae366ef69618d62 (patch)
treecb9e8bfb66640ac3b29c934bb2c3202d25aeb368 /plugin/rpcplugin/main_test.go
parentecefa6cdd1e7376046bbec82c1b47f7756fea646 (diff)
downloadchat-1e5c432e1029601a664454388ae366ef69618d62.tar.gz
chat-1e5c432e1029601a664454388ae366ef69618d62.tar.bz2
chat-1e5c432e1029601a664454388ae366ef69618d62.zip
MM-10702 Moving plugins to use hashicorp go-plugin. (#8978)
* Moving plugins to use hashicorp go-plugin. * Tweaks from feedback.
Diffstat (limited to 'plugin/rpcplugin/main_test.go')
-rw-r--r--plugin/rpcplugin/main_test.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/plugin/rpcplugin/main_test.go b/plugin/rpcplugin/main_test.go
deleted file mode 100644
index 06423106c..000000000
--- a/plugin/rpcplugin/main_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package rpcplugin
-
-import (
- "context"
- "io/ioutil"
- "os"
- "path/filepath"
- "testing"
-
- "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)
-
- plugin := filepath.Join(dir, "plugin.exe")
- rpcplugintest.CompileGo(t, `
- package main
-
- import (
- "github.com/mattermost/mattermost-server/plugin/rpcplugin"
- )
-
- type MyPlugin struct {}
-
- func main() {
- rpcplugin.Main(&MyPlugin{})
- }
- `, plugin)
-
- ctx, cancel := context.WithCancel(context.Background())
- p, ipc, err := NewProcess(ctx, plugin)
- require.NoError(t, err)
- defer p.Wait()
-
- muxer := NewMuxer(ipc, false)
- defer muxer.Close()
-
- defer cancel()
-
- var api plugintest.API
-
- hooks, err := ConnectMain(muxer, "plugin_id")
- require.NoError(t, err)
- assert.NoError(t, hooks.OnActivate(&api))
- assert.NoError(t, hooks.OnDeactivate())
-}