- Fix panic due to not checking for JSON marshal error
- Reorder the FileExists check which would fail if we were to pass
the -short flag to bypass the slow URL test. In which case, the plugin
would have been removed from the filesystem.
So we move the check before we remove the plugin.

https://mattermost.atlassian.net/browse/MM-22666
Этот коммит содержится в:
Agniva De Sarker
2020-02-26 14:11:24 +00:00
коммит произвёл GitHub
родитель 4587913b49
Коммит 2835163b18

Просмотреть файл

@@ -33,7 +33,8 @@ func TestPlugin(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
statesJson, _ := json.Marshal(th.App.Config().PluginSettings.PluginStates)
statesJson, err := json.Marshal(th.App.Config().PluginSettings.PluginStates)
require.Nil(t, err)
states := map[string]*model.PluginState{}
json.Unmarshal(statesJson, &states)
th.App.UpdateConfig(func(cfg *model.Config) {
@@ -66,6 +67,11 @@ func TestPlugin(t *testing.T) {
CheckNoError(t, resp)
assert.Equal(t, "testplugin", manifest.Id)
// Stored in File Store: Install Plugin from URL case
pluginStored, err := th.App.FileExists("./plugins/" + manifest.Id + ".tar.gz")
assert.Nil(t, err)
assert.True(t, pluginStored)
ok, resp := th.SystemAdminClient.RemovePlugin(manifest.Id)
CheckNoError(t, resp)
require.True(t, ok)
@@ -88,11 +94,6 @@ func TestPlugin(t *testing.T) {
assert.Equal(t, "testplugin", manifest.Id)
})
// Stored in File Store: Install Plugin from URL case
pluginStored, err := th.App.FileExists("./plugins/" + manifest.Id + ".tar.gz")
assert.Nil(t, err)
assert.True(t, pluginStored)
th.App.RemovePlugin(manifest.Id)
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.Enable = false })