diff options
author | Chris <ccbrown112@gmail.com> | 2018-01-15 11:21:06 -0600 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-01-15 09:21:06 -0800 |
commit | f5c8a71698d0a7a16c68be220e49fe64bfee7f5c (patch) | |
tree | 194b9cc79eceb1c91c44e39b9d797671c178fe0e /plugin/rpcplugin/process_test.go | |
parent | 7e5ce976681e99be6b26d428935ba1106d530efa (diff) | |
download | chat-f5c8a71698d0a7a16c68be220e49fe64bfee7f5c.tar.gz chat-f5c8a71698d0a7a16c68be220e49fe64bfee7f5c.tar.bz2 chat-f5c8a71698d0a7a16c68be220e49fe64bfee7f5c.zip |
ABC-22: Plugin sandboxing for linux/amd64 (#8068)
* plugin sandboxing
* remove unused type
* better symlink handling, better remounting, better test, whitespace
fixes, and comment on the remounting
* fix test compile error
* big simplification for getting mount flags
* mask statfs flags to the ones we're interested in
Diffstat (limited to 'plugin/rpcplugin/process_test.go')
-rw-r--r-- | plugin/rpcplugin/process_test.go | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/plugin/rpcplugin/process_test.go b/plugin/rpcplugin/process_test.go index 473cc026b..8d1794293 100644 --- a/plugin/rpcplugin/process_test.go +++ b/plugin/rpcplugin/process_test.go @@ -4,25 +4,14 @@ import ( "context" "io/ioutil" "os" - "os/exec" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" -) -func compileGo(t *testing.T, sourceCode, outputPath string) { - dir, err := ioutil.TempDir(".", "") - require.NoError(t, err) - defer os.RemoveAll(dir) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte(sourceCode), 0600)) - cmd := exec.Command("go", "build", "-o", outputPath, "main.go") - cmd.Dir = dir - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - require.NoError(t, cmd.Run()) -} + "github.com/mattermost/mattermost-server/plugin/rpcplugin/rpcplugintest" +) func TestProcess(t *testing.T) { dir, err := ioutil.TempDir("", "") @@ -30,7 +19,7 @@ func TestProcess(t *testing.T) { defer os.RemoveAll(dir) ping := filepath.Join(dir, "ping.exe") - compileGo(t, ` + rpcplugintest.CompileGo(t, ` package main import ( |