summaryrefslogtreecommitdiffstats
path: root/migrations
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 /migrations
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 'migrations')
-rw-r--r--migrations/migrationstestlib.go62
1 files changed, 0 insertions, 62 deletions
diff --git a/migrations/migrationstestlib.go b/migrations/migrationstestlib.go
index b501291b0..0d9aeb3e3 100644
--- a/migrations/migrationstestlib.go
+++ b/migrations/migrationstestlib.go
@@ -4,19 +4,15 @@
package migrations
import (
- "encoding/json"
"io"
"io/ioutil"
"os"
- "path/filepath"
"time"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/einterfaces"
"github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/plugin"
- "github.com/mattermost/mattermost-server/plugin/pluginenv"
"github.com/mattermost/mattermost-server/store"
"github.com/mattermost/mattermost-server/store/sqlstore"
"github.com/mattermost/mattermost-server/store/storetest"
@@ -35,7 +31,6 @@ type TestHelper struct {
tempConfigPath string
tempWorkspace string
- pluginHooks map[string]plugin.Hooks
}
type persistentTestStore struct {
@@ -93,7 +88,6 @@ func setupTestHelper(enterprise bool) *TestHelper {
th := &TestHelper{
App: a,
- pluginHooks: make(map[string]plugin.Hooks),
tempConfigPath: tempConfig.Name(),
}
@@ -307,62 +301,6 @@ func (me *TestHelper) TearDown() {
}
}
-type mockPluginSupervisor struct {
- hooks plugin.Hooks
-}
-
-func (s *mockPluginSupervisor) Start(api plugin.API) error {
- return s.hooks.OnActivate(api)
-}
-
-func (s *mockPluginSupervisor) Stop() error {
- return nil
-}
-
-func (s *mockPluginSupervisor) Hooks() plugin.Hooks {
- return s.hooks
-}
-
-func (s *mockPluginSupervisor) Wait() error { return nil }
-
-func (me *TestHelper) InstallPlugin(manifest *model.Manifest, hooks plugin.Hooks) {
- if me.tempWorkspace == "" {
- dir, err := ioutil.TempDir("", "apptest")
- if err != nil {
- panic(err)
- }
- me.tempWorkspace = dir
- }
-
- pluginDir := filepath.Join(me.tempWorkspace, "plugins")
- webappDir := filepath.Join(me.tempWorkspace, "webapp")
- me.App.InitPlugins(pluginDir, webappDir, func(bundle *model.BundleInfo) (plugin.Supervisor, error) {
- if hooks, ok := me.pluginHooks[bundle.Manifest.Id]; ok {
- return &mockPluginSupervisor{hooks}, nil
- }
- return pluginenv.DefaultSupervisorProvider(bundle)
- })
-
- me.pluginHooks[manifest.Id] = hooks
-
- manifestCopy := *manifest
- if manifestCopy.Backend == nil {
- manifestCopy.Backend = &model.ManifestBackend{}
- }
- manifestBytes, err := json.Marshal(&manifestCopy)
- if err != nil {
- panic(err)
- }
-
- if err := os.MkdirAll(filepath.Join(pluginDir, manifest.Id), 0700); err != nil {
- panic(err)
- }
-
- if err := ioutil.WriteFile(filepath.Join(pluginDir, manifest.Id, "plugin.json"), manifestBytes, 0600); err != nil {
- panic(err)
- }
-}
-
func (me *TestHelper) ResetRoleMigration() {
if _, err := testStoreSqlSupplier.GetMaster().Exec("DELETE from Roles"); err != nil {
panic(err)