MM-10658 Change config fields to pointers (#9033)
* MM 10658 Change config fields to pointers (#8898) * Change fields of config structs to pointers and set defaults MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix tests that go broken during switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Apply changes of current master while switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix new config pointer uses * Fix app tests * Fix mail test * remove debugging statement * fix TestUpdateConfig * assign config consistently * initialize AmazonS3Region in TestS3TestConnection * initialize fields for TestEmailTest * fix TestCheckMandatoryS3Fields
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0c981aa010
Коммит
2ca222033c
@@ -76,7 +76,7 @@ func runServer(configFileLocation string, disableConfigWatch bool, usedPlatform
|
||||
web.New(server, server.AppOptions, server.Router)
|
||||
|
||||
// If we allow testing then listen for manual testing URL hits
|
||||
if server.Config().ServiceSettings.EnableTesting {
|
||||
if *server.Config().ServiceSettings.EnableTesting {
|
||||
manualtesting.Init(api)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ func setupClientTests(cfg *model.Config) {
|
||||
*cfg.TeamSettings.EnableOpenServer = true
|
||||
*cfg.ServiceSettings.EnableCommands = false
|
||||
*cfg.ServiceSettings.EnableCustomEmoji = true
|
||||
cfg.ServiceSettings.EnableIncomingWebhooks = false
|
||||
cfg.ServiceSettings.EnableOutgoingWebhooks = false
|
||||
*cfg.ServiceSettings.EnableIncomingWebhooks = false
|
||||
*cfg.ServiceSettings.EnableOutgoingWebhooks = false
|
||||
}
|
||||
|
||||
func executeTestCommand(command *exec.Cmd) {
|
||||
|
||||
@@ -21,16 +21,16 @@ func TestListWebhooks(t *testing.T) {
|
||||
|
||||
config := th.Config()
|
||||
*config.ServiceSettings.EnableCommands = true
|
||||
config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
config.ServiceSettings.EnablePostIconOverride = true
|
||||
*config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
*config.ServiceSettings.EnablePostIconOverride = true
|
||||
th.SetConfig(config)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
@@ -139,16 +139,16 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
|
||||
config := th.Config()
|
||||
*config.ServiceSettings.EnableCommands = true
|
||||
config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
config.ServiceSettings.EnablePostIconOverride = true
|
||||
*config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
*config.ServiceSettings.EnablePostIconOverride = true
|
||||
th.SetConfig(config)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
@@ -191,16 +191,16 @@ func TestModifyIncomingWebhook(t *testing.T) {
|
||||
|
||||
config := th.Config()
|
||||
*config.ServiceSettings.EnableCommands = true
|
||||
config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
config.ServiceSettings.EnablePostIconOverride = true
|
||||
*config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
*config.ServiceSettings.EnablePostIconOverride = true
|
||||
th.SetConfig(config)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
@@ -254,16 +254,16 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
|
||||
config := th.Config()
|
||||
*config.ServiceSettings.EnableCommands = true
|
||||
config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
config.ServiceSettings.EnablePostIconOverride = true
|
||||
*config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
*config.ServiceSettings.EnablePostIconOverride = true
|
||||
th.SetConfig(config)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
@@ -322,7 +322,7 @@ func TestModifyOutgoingWebhook(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
th.SetConfig(config)
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
@@ -423,16 +423,16 @@ func TestDeleteWebhooks(t *testing.T) {
|
||||
|
||||
config := th.Config()
|
||||
*config.ServiceSettings.EnableCommands = true
|
||||
config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
config.ServiceSettings.EnablePostIconOverride = true
|
||||
*config.ServiceSettings.EnableIncomingWebhooks = true
|
||||
*config.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*config.ServiceSettings.EnablePostUsernameOverride = true
|
||||
*config.ServiceSettings.EnablePostIconOverride = true
|
||||
th.SetConfig(config)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostUsernameOverride = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnablePostIconOverride = true })
|
||||
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
|
||||
Ссылка в новой задаче
Block a user