summaryrefslogtreecommitdiffstats
path: root/api/command_loadtest_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-18 15:36:43 -0700
committerGitHub <noreply@github.com>2017-10-18 15:36:43 -0700
commit8e19ba029f889519d93cf272960dce858971106c (patch)
treed8f38ac62661fb8578e2b5c3c619fe31ab29f480 /api/command_loadtest_test.go
parent34a87fa8f47b1447b73e3ae56866b654801b3eee (diff)
downloadchat-8e19ba029f889519d93cf272960dce858971106c.tar.gz
chat-8e19ba029f889519d93cf272960dce858971106c.tar.bz2
chat-8e19ba029f889519d93cf272960dce858971106c.zip
Reduce utils.Cfg references (#7650)
* app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
Diffstat (limited to 'api/command_loadtest_test.go')
-rw-r--r--api/command_loadtest_test.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/api/command_loadtest_test.go b/api/command_loadtest_test.go
index 346b3379e..62545ae64 100644
--- a/api/command_loadtest_test.go
+++ b/api/command_loadtest_test.go
@@ -9,7 +9,6 @@ import (
"time"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func TestLoadTestHelpCommands(t *testing.T) {
@@ -20,12 +19,12 @@ func TestLoadTestHelpCommands(t *testing.T) {
channel := th.BasicChannel
// enable testing to use /test but don't save it since we don't want to overwrite config.json
- enableTesting := utils.Cfg.ServiceSettings.EnableTesting
+ enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
- utils.Cfg.ServiceSettings.EnableTesting = enableTesting
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
- utils.Cfg.ServiceSettings.EnableTesting = true
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.Command(channel.Id, "/test help")).Data.(*model.CommandResponse)
if !strings.Contains(rs.Text, "Mattermost testing commands to help") {
@@ -43,12 +42,12 @@ func TestLoadTestSetupCommands(t *testing.T) {
channel := th.BasicChannel
// enable testing to use /test but don't save it since we don't want to overwrite config.json
- enableTesting := utils.Cfg.ServiceSettings.EnableTesting
+ enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
- utils.Cfg.ServiceSettings.EnableTesting = enableTesting
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
- utils.Cfg.ServiceSettings.EnableTesting = true
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.Command(channel.Id, "/test setup fuzz 1 1 1")).Data.(*model.CommandResponse)
if rs.Text != "Created enviroment" {
@@ -66,12 +65,12 @@ func TestLoadTestUsersCommands(t *testing.T) {
channel := th.BasicChannel
// enable testing to use /test but don't save it since we don't want to overwrite config.json
- enableTesting := utils.Cfg.ServiceSettings.EnableTesting
+ enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
- utils.Cfg.ServiceSettings.EnableTesting = enableTesting
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
- utils.Cfg.ServiceSettings.EnableTesting = true
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.Command(channel.Id, "/test users fuzz 1 2")).Data.(*model.CommandResponse)
if rs.Text != "Added users" {
@@ -89,12 +88,12 @@ func TestLoadTestChannelsCommands(t *testing.T) {
channel := th.BasicChannel
// enable testing to use /test but don't save it since we don't want to overwrite config.json
- enableTesting := utils.Cfg.ServiceSettings.EnableTesting
+ enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
- utils.Cfg.ServiceSettings.EnableTesting = enableTesting
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
- utils.Cfg.ServiceSettings.EnableTesting = true
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.Command(channel.Id, "/test channels fuzz 1 2")).Data.(*model.CommandResponse)
if rs.Text != "Added channels" {
@@ -112,12 +111,12 @@ func TestLoadTestPostsCommands(t *testing.T) {
channel := th.BasicChannel
// enable testing to use /test but don't save it since we don't want to overwrite config.json
- enableTesting := utils.Cfg.ServiceSettings.EnableTesting
+ enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
- utils.Cfg.ServiceSettings.EnableTesting = enableTesting
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
- utils.Cfg.ServiceSettings.EnableTesting = true
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.Command(channel.Id, "/test posts fuzz 2 3 2")).Data.(*model.CommandResponse)
if rs.Text != "Added posts" {