summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/ipc_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/ipc_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/ipc_test.go')
-rw-r--r--plugin/rpcplugin/ipc_test.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/plugin/rpcplugin/ipc_test.go b/plugin/rpcplugin/ipc_test.go
deleted file mode 100644
index 76699a11e..000000000
--- a/plugin/rpcplugin/ipc_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/plugin/rpcplugin/rpcplugintest"
-)
-
-func TestIPC(t *testing.T) {
- dir, err := ioutil.TempDir("", "")
- require.NoError(t, err)
- defer os.RemoveAll(dir)
-
- pingpong := filepath.Join(dir, "pingpong.exe")
- rpcplugintest.CompileGo(t, `
- package main
-
- import (
- "log"
-
- "github.com/mattermost/mattermost-server/plugin/rpcplugin"
- )
-
- func main() {
- ipc, err := rpcplugin.InheritedProcessIPC()
- if err != nil {
- log.Fatal("unable to get inherited ipc")
- }
- defer ipc.Close()
- _, err = ipc.Write([]byte("ping"))
- if err != nil {
- log.Fatal("unable to write to ipc")
- }
- b := make([]byte, 10)
- n, err := ipc.Read(b)
- if err != nil {
- log.Fatal("unable to read from ipc")
- }
- if n != 4 || string(b[:4]) != "pong" {
- log.Fatal("unexpected response")
- }
- }
- `, pingpong)
-
- p, ipc, err := NewProcess(context.Background(), pingpong)
- require.NoError(t, err)
- defer ipc.Close()
- b := make([]byte, 10)
- n, err := ipc.Read(b)
- require.NoError(t, err)
- assert.Equal(t, 4, n)
- assert.Equal(t, "ping", string(b[:4]))
- _, err = ipc.Write([]byte("pong"))
- require.NoError(t, err)
- require.NoError(t, p.Wait())
-}