diff options
author | Chris <ccbrown112@gmail.com> | 2017-09-12 14:12:29 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-09-12 15:12:29 -0400 |
commit | 4731b8f9b993536ed61dbc065e161e8994253f0d (patch) | |
tree | 140e7407ef793204dd94e1b58a725e836c75b2b5 /app | |
parent | b066b6df138e88e75cb40f1ec3e58fbd13e61909 (diff) | |
download | chat-4731b8f9b993536ed61dbc065e161e8994253f0d.tar.gz chat-4731b8f9b993536ed61dbc065e161e8994253f0d.tar.bz2 chat-4731b8f9b993536ed61dbc065e161e8994253f0d.zip |
fix plugin test (#7436)
* fix plugin test
* ugh. global state
* Fix plugin test
* Fix TestDeleteChannel
* Remove plugin config listener when shutting down
Diffstat (limited to 'app')
-rw-r--r-- | app/app.go | 5 | ||||
-rw-r--r-- | app/apptestlib.go | 8 | ||||
-rw-r--r-- | app/plugins.go | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/app/app.go b/app/app.go index 953ca285a..667c425bd 100644 --- a/app/app.go +++ b/app/app.go @@ -11,8 +11,9 @@ import ( ) type App struct { - Srv *Server - PluginEnv *pluginenv.Environment + Srv *Server + PluginEnv *pluginenv.Environment + PluginConfigListenerId string } var globalApp App diff --git a/app/apptestlib.go b/app/apptestlib.go index a640ff391..67a380f2d 100644 --- a/app/apptestlib.go +++ b/app/apptestlib.go @@ -33,9 +33,6 @@ func setupTestHelper(enterprise bool) *TestHelper { *utils.Cfg.TeamSettings.MaxUsersPerTeam = 50 *utils.Cfg.RateLimitSettings.Enable = false utils.DisableDebugLogForTest() - if enterprise { - utils.License().Features.SetDefaults() - } th.App.NewServer() th.App.InitStores() th.App.StartServer() @@ -46,6 +43,11 @@ func setupTestHelper(enterprise bool) *TestHelper { *utils.Cfg.TeamSettings.EnableOpenServer = true } + utils.SetIsLicensed(enterprise) + if enterprise { + utils.License().Features.SetDefaults() + } + return th } diff --git a/app/plugins.go b/app/plugins.go index f165f7b49..f00308a86 100644 --- a/app/plugins.go +++ b/app/plugins.go @@ -354,7 +354,7 @@ func (a *App) InitPlugins(pluginPath, webappPath string) { return } - utils.AddConfigListener(func(_, _ *model.Config) { + a.PluginConfigListenerId = utils.AddConfigListener(func(_, _ *model.Config) { for _, err := range a.PluginEnv.Hooks().OnConfigurationChange() { l4g.Error(err.Error()) } @@ -412,4 +412,6 @@ func (a *App) ShutDownPlugins() { for _, err := range a.PluginEnv.Shutdown() { l4g.Error(err.Error()) } + utils.RemoveConfigListener(a.PluginConfigListenerId) + a.PluginConfigListenerId = "" } |