summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/supervisor_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-09-11 10:02:02 -0500
committerGitHub <noreply@github.com>2017-09-11 10:02:02 -0500
commit402491b7e52c4d836c1274976cdb387852cfd17b (patch)
treee8adcbdf0af5370f8af11e3fc1021a328c971a5d /plugin/rpcplugin/supervisor_test.go
parenta69bed712d53e9a7984915fffffc8a2fd1647a7a (diff)
downloadchat-402491b7e52c4d836c1274976cdb387852cfd17b.tar.gz
chat-402491b7e52c4d836c1274976cdb387852cfd17b.tar.bz2
chat-402491b7e52c4d836c1274976cdb387852cfd17b.zip
PLT-7407: Back-end plugins (#7409)
* tie back-end plugins together * fix comment typo * add tests and a bit of polish * tests and polish * add test, don't let backend executable paths escape the plugin directory
Diffstat (limited to 'plugin/rpcplugin/supervisor_test.go')
-rw-r--r--plugin/rpcplugin/supervisor_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugin/rpcplugin/supervisor_test.go b/plugin/rpcplugin/supervisor_test.go
index 6940adcad..bad38b2d7 100644
--- a/plugin/rpcplugin/supervisor_test.go
+++ b/plugin/rpcplugin/supervisor_test.go
@@ -43,6 +43,19 @@ func TestSupervisor(t *testing.T) {
require.NoError(t, supervisor.Stop())
}
+func TestSupervisor_InvalidExecutablePath(t *testing.T) {
+ dir, err := ioutil.TempDir("", "")
+ require.NoError(t, err)
+ defer os.RemoveAll(dir)
+
+ ioutil.WriteFile(filepath.Join(dir, "plugin.json"), []byte(`{"id": "foo", "backend": {"executable": "/foo/../../backend.exe"}}`), 0600)
+
+ bundle := model.BundleInfoForPath(dir)
+ supervisor, err := SupervisorProvider(bundle)
+ assert.Nil(t, supervisor)
+ assert.Error(t, err)
+}
+
// If plugin development goes really wrong, let's make sure plugin activation won't block forever.
func TestSupervisor_StartTimeout(t *testing.T) {
dir, err := ioutil.TempDir("", "")