From 1e5c432e1029601a664454388ae366ef69618d62 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 25 Jun 2018 12:33:13 -0700 Subject: MM-10702 Moving plugins to use hashicorp go-plugin. (#8978) * Moving plugins to use hashicorp go-plugin. * Tweaks from feedback. --- api4/apitestlib.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'api4/apitestlib.go') diff --git a/api4/apitestlib.go b/api4/apitestlib.go index 8293a03f7..ff7d47b26 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -49,6 +49,7 @@ type TestHelper struct { SystemAdminClient *model.Client4 SystemAdminUser *model.User + tempWorkspace string } type persistentTestStore struct { @@ -137,6 +138,25 @@ func setupTestHelper(enterprise bool) *TestHelper { th.Client = th.CreateClient() th.SystemAdminClient = th.CreateClient() + + if th.tempWorkspace == "" { + dir, err := ioutil.TempDir("", "apptest") + if err != nil { + panic(err) + } + th.tempWorkspace = dir + } + + pluginDir := filepath.Join(th.tempWorkspace, "plugins") + webappDir := filepath.Join(th.tempWorkspace, "webapp") + + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.PluginSettings.Directory = pluginDir + *cfg.PluginSettings.ClientDirectory = webappDir + }) + + th.App.InitPlugins(pluginDir, webappDir) + return th } -- cgit v1.2.3-1-g7c22