Disable morph logging during TestMain (#30948)
* rm "No TEST_DATABASE... override" log message Let's only log if this value is actually overridden. * rm "(Created|Dropped) temporary database" message * only log "Pinging SQL" on subsequent attempts * disable morph logging from TestMain * Fix style issues in store test files - Add missing parameter to migrate() function calls in tests - Remove unused log function in settings.go - Fix formatting with go fmt 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * within sqlstore, use "enable" vs "disable" for clarity * remove trailing newline from morph logs --------- Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
92db356484
Коммит
31a8047973
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/localcachelayer"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
|
||||
"github.com/mattermost/mattermost/server/v8/config"
|
||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||
"github.com/mattermost/mattermost/server/v8/platform/shared/filestore"
|
||||
@@ -63,6 +64,16 @@ func StoreOverrideWithCache(override store.Store) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// StoreOption allows passing options when constructing the store.
|
||||
//
|
||||
// This option has no effect if StoreOverride or StoreOverrideWithCache is also set.
|
||||
func StoreOption(option sqlstore.Option) Option {
|
||||
return func(ps *PlatformService) error {
|
||||
ps.storeOptions = append(ps.storeOptions, option)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Config applies the given config dsn, whether a path to config.json
|
||||
// or a database connection string. It receives as well a set of
|
||||
// custom defaults that will be applied for any unset property of the
|
||||
|
||||
@@ -38,9 +38,10 @@ import (
|
||||
// responsible for non-entity related functionalities that are required
|
||||
// by a product such as database access, configuration access, licensing etc.
|
||||
type PlatformService struct {
|
||||
sqlStore *sqlstore.SqlStore
|
||||
Store store.Store
|
||||
newStore func() (store.Store, error)
|
||||
sqlStore *sqlstore.SqlStore
|
||||
Store store.Store
|
||||
newStore func() (store.Store, error)
|
||||
storeOptions []sqlstore.Option
|
||||
|
||||
WebSocketRouter *WebSocketRouter
|
||||
|
||||
@@ -232,7 +233,7 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) {
|
||||
// Timer layer
|
||||
// |
|
||||
// Cache layer
|
||||
ps.sqlStore, err = sqlstore.New(ps.Config().SqlSettings, ps.Log(), ps.metricsIFace)
|
||||
ps.sqlStore, err = sqlstore.New(ps.Config().SqlSettings, ps.Log(), ps.metricsIFace, ps.storeOptions...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user