[MM-18150] plugin panic trace should not be lost (#13559)
* Transit panic from debug to error * Parse plugin's StdErr and output panic to the mlog.Error * Add unit tests * Change log test * Remove buffer from logger * Remove 'panic' string filter * Change *Buffer to io.Writer Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
771574b652
Коммит
5d928b4f94
@@ -4,6 +4,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -33,11 +34,11 @@ type TestHelper struct {
|
||||
BasicChannel *model.Channel
|
||||
BasicPost *model.Post
|
||||
|
||||
SystemAdminUser *model.User
|
||||
SystemAdminUser *model.User
|
||||
LogBuffer *bytes.Buffer
|
||||
IncludeCacheLayer bool
|
||||
|
||||
tempWorkspace string
|
||||
|
||||
IncludeCacheLayer bool
|
||||
}
|
||||
|
||||
func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer bool, tb testing.TB, configSet func(*model.Config)) *TestHelper {
|
||||
@@ -59,10 +60,12 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
*config.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp")
|
||||
memoryStore.Set(config)
|
||||
|
||||
buffer := &bytes.Buffer{}
|
||||
|
||||
var options []Option
|
||||
options = append(options, ConfigStore(memoryStore))
|
||||
options = append(options, StoreOverride(dbStore))
|
||||
options = append(options, SetLogger(mlog.NewTestingLogger(tb)))
|
||||
options = append(options, SetLogger(mlog.NewTestingLogger(tb, buffer)))
|
||||
|
||||
s, err := NewServer(options...)
|
||||
if err != nil {
|
||||
@@ -77,6 +80,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
th := &TestHelper{
|
||||
App: s.FakeApp(),
|
||||
Server: s,
|
||||
LogBuffer: buffer,
|
||||
IncludeCacheLayer: includeCacheLayer,
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user