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
@@ -56,7 +56,7 @@ func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if c.App.Config().LogSettings.EnableWebhookDebugging {
|
||||
if *c.App.Config().LogSettings.EnableWebhookDebugging {
|
||||
mlog.Debug(fmt.Sprintf("Incoming webhook received. Id=%s Content=%s", id, incomingWebhookPayload.ToJson()))
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
if !th.App.Config().ServiceSettings.EnableIncomingWebhooks {
|
||||
if !*th.App.Config().ServiceSettings.EnableIncomingWebhooks {
|
||||
_, err := http.Post(ApiClient.Url+"/hooks/123", "", strings.NewReader("123"))
|
||||
assert.NotNil(t, err, "should have errored - webhooks turned off")
|
||||
return
|
||||
@@ -224,7 +224,7 @@ func TestIncomingWebhook(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("DisableWebhooks", func(t *testing.T) {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableIncomingWebhooks = false })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = false })
|
||||
resp, err := http.Post(url, "application/json", strings.NewReader("{\"text\":\"this is a test\"}"))
|
||||
require.Nil(t, err)
|
||||
assert.True(t, resp.StatusCode == http.StatusNotImplemented)
|
||||
|
||||
Ссылка в новой задаче
Block a user