MM-12974: guard app plugins with mutex (#9818)
* guard app plugins with mutex Shutting down the app could race with a goroutine that uses the plugins environment, since we shut down the plugins first before cleaning up goroutines. * fix go vet issues
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
0a73690537
Коммит
c46d8ec892
@@ -41,7 +41,7 @@ func setupPluginApiTest(t *testing.T, pluginCode string, pluginManifest string,
|
||||
require.NotNil(t, manifest)
|
||||
require.True(t, activated)
|
||||
|
||||
app.Srv.Plugins = env
|
||||
app.SetPluginsEnvironment(env)
|
||||
}
|
||||
|
||||
func TestPluginAPIUpdateUserStatus(t *testing.T) {
|
||||
@@ -206,7 +206,7 @@ func TestPluginAPILoadPluginConfiguration(t *testing.T) {
|
||||
}
|
||||
]
|
||||
}}`, "testloadpluginconfig", th.App)
|
||||
hooks, err := th.App.Srv.Plugins.HooksForPlugin("testloadpluginconfig")
|
||||
hooks, err := th.App.GetPluginsEnvironment().HooksForPlugin("testloadpluginconfig")
|
||||
assert.NoError(t, err)
|
||||
_, ret := hooks.MessageWillBePosted(nil, nil)
|
||||
assert.Equal(t, "str32true", ret)
|
||||
@@ -280,7 +280,7 @@ func TestPluginAPILoadPluginConfigurationDefaults(t *testing.T) {
|
||||
}
|
||||
]
|
||||
}}`, "testloadpluginconfig", th.App)
|
||||
hooks, err := th.App.Srv.Plugins.HooksForPlugin("testloadpluginconfig")
|
||||
hooks, err := th.App.GetPluginsEnvironment().HooksForPlugin("testloadpluginconfig")
|
||||
assert.NoError(t, err)
|
||||
_, ret := hooks.MessageWillBePosted(nil, nil)
|
||||
assert.Equal(t, "override35true", ret)
|
||||
@@ -377,9 +377,9 @@ func TestPluginAPIGetPlugins(t *testing.T) {
|
||||
require.True(t, activated)
|
||||
pluginManifests = append(pluginManifests, manifest)
|
||||
}
|
||||
th.App.Srv.Plugins = env
|
||||
th.App.SetPluginsEnvironment(env)
|
||||
|
||||
// Decative the last one for testing
|
||||
// Decativate the last one for testing
|
||||
sucess := env.Deactivate(pluginIDs[len(pluginIDs)-1])
|
||||
require.True(t, sucess)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user