[MM-64296] Help for AI: Respect env overrides for consoleLevel (#31278)
* respect env overrides for consoleLevel; add tests * clean up test * merge conflict * improve parallelizability * be better commenting * better name for fn, comment explaining why we're using it * empty * empty * empty --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
efc8094bc2
Коммит
c0f1cbf727
@@ -99,7 +99,13 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, sqlSettings *model.SqlS
|
||||
*memoryConfig.ServiceSettings.EnableLocalMode = true
|
||||
*memoryConfig.ServiceSettings.LocalModeSocketLocation = filepath.Join(tempWorkspace, "mattermost_local.sock")
|
||||
*memoryConfig.LogSettings.EnableSentry = false // disable error reporting during tests
|
||||
*memoryConfig.LogSettings.ConsoleLevel = mlog.LvlStdLog.Name
|
||||
|
||||
// Check for environment variable override for console log level (useful for debugging tests)
|
||||
consoleLevel := os.Getenv("MM_LOGSETTINGS_CONSOLELEVEL")
|
||||
if consoleLevel == "" {
|
||||
consoleLevel = mlog.LvlStdLog.Name
|
||||
}
|
||||
*memoryConfig.LogSettings.ConsoleLevel = consoleLevel
|
||||
*memoryConfig.LogSettings.FileLocation = filepath.Join(tempWorkspace, "logs", "mattermost.log")
|
||||
*memoryConfig.AnnouncementSettings.AdminNoticesEnabled = false
|
||||
*memoryConfig.AnnouncementSettings.UserNoticesEnabled = false
|
||||
@@ -270,8 +276,13 @@ func SetupEnterprise(tb testing.TB, options ...app.Option) *TestHelper {
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
removeSpuriousErrors := func(config *model.Config) {
|
||||
// If not set, you will receive an unactionable error in the console
|
||||
*config.ServiceSettings.SiteURL = "http://localhost:8065"
|
||||
}
|
||||
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, true, true, nil, options)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, true, true, removeSpuriousErrors, options)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
@@ -355,7 +366,12 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
}
|
||||
|
||||
func SetupEnterpriseWithStoreMock(tb testing.TB, options ...app.Option) *TestHelper {
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, nil, true, false, nil, options)
|
||||
removeSpuriousErrors := func(config *model.Config) {
|
||||
// If not set, you will receive an unactionable error in the console
|
||||
*config.ServiceSettings.SiteURL = "http://localhost:8065"
|
||||
}
|
||||
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, nil, true, false, removeSpuriousErrors, options)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
|
||||
Ссылка в новой задаче
Block a user