summaryrefslogtreecommitdiffstats
path: root/api/command_loadtest_test.go
diff options
context:
space:
mode:
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" {