2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2016-01-10 01:13:51 -06:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
|
|
2017-09-06 23:05:10 -07:00
|
|
|
"github.com/mattermost/mattermost-server/model"
|
2016-01-10 01:13:51 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestLoadTestHelpCommands(t *testing.T) {
|
2016-04-21 22:37:01 -07:00
|
|
|
th := Setup().InitBasic()
|
2017-10-02 03:50:56 -05:00
|
|
|
defer th.TearDown()
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
Client := th.BasicClient
|
|
|
|
|
channel := th.BasicChannel
|
|
|
|
|
|
2017-10-18 15:36:43 -07:00
|
|
|
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
|
2016-01-10 01:13:51 -06:00
|
|
|
|
2017-06-15 11:05:43 -04:00
|
|
|
rs := Client.Must(Client.Command(channel.Id, "/test help")).Data.(*model.CommandResponse)
|
|
|
|
|
if !strings.Contains(rs.Text, "Mattermost testing commands to help") {
|
2016-01-10 01:13:51 -06:00
|
|
|
t.Fatal(rs.Text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestLoadTestSetupCommands(t *testing.T) {
|
2016-04-21 22:37:01 -07:00
|
|
|
th := Setup().InitBasic()
|
2017-10-02 03:50:56 -05:00
|
|
|
defer th.TearDown()
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
Client := th.BasicClient
|
|
|
|
|
channel := th.BasicChannel
|
|
|
|
|
|
2017-10-18 15:36:43 -07:00
|
|
|
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
|
2016-01-10 01:13:51 -06:00
|
|
|
|
2017-06-15 11:05:43 -04:00
|
|
|
rs := Client.Must(Client.Command(channel.Id, "/test setup fuzz 1 1 1")).Data.(*model.CommandResponse)
|
2016-04-25 05:39:02 -07:00
|
|
|
if rs.Text != "Created enviroment" {
|
2016-01-10 01:13:51 -06:00
|
|
|
t.Fatal(rs.Text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestLoadTestUsersCommands(t *testing.T) {
|
2016-04-21 22:37:01 -07:00
|
|
|
th := Setup().InitBasic()
|
2017-10-02 03:50:56 -05:00
|
|
|
defer th.TearDown()
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
Client := th.BasicClient
|
|
|
|
|
channel := th.BasicChannel
|
|
|
|
|
|
2017-10-18 15:36:43 -07:00
|
|
|
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
|
2016-01-10 01:13:51 -06:00
|
|
|
|
2017-06-15 11:05:43 -04:00
|
|
|
rs := Client.Must(Client.Command(channel.Id, "/test users fuzz 1 2")).Data.(*model.CommandResponse)
|
2016-04-25 05:39:02 -07:00
|
|
|
if rs.Text != "Added users" {
|
2016-01-10 01:13:51 -06:00
|
|
|
t.Fatal(rs.Text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestLoadTestChannelsCommands(t *testing.T) {
|
2016-04-21 22:37:01 -07:00
|
|
|
th := Setup().InitBasic()
|
2017-10-02 03:50:56 -05:00
|
|
|
defer th.TearDown()
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
Client := th.BasicClient
|
|
|
|
|
channel := th.BasicChannel
|
|
|
|
|
|
2017-10-18 15:36:43 -07:00
|
|
|
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
|
2016-01-10 01:13:51 -06:00
|
|
|
|
2017-06-15 11:05:43 -04:00
|
|
|
rs := Client.Must(Client.Command(channel.Id, "/test channels fuzz 1 2")).Data.(*model.CommandResponse)
|
2016-04-25 05:39:02 -07:00
|
|
|
if rs.Text != "Added channels" {
|
2016-01-10 01:13:51 -06:00
|
|
|
t.Fatal(rs.Text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestLoadTestPostsCommands(t *testing.T) {
|
2016-04-21 22:37:01 -07:00
|
|
|
th := Setup().InitBasic()
|
2017-10-02 03:50:56 -05:00
|
|
|
defer th.TearDown()
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
Client := th.BasicClient
|
|
|
|
|
channel := th.BasicChannel
|
|
|
|
|
|
2017-10-18 15:36:43 -07:00
|
|
|
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
|
2016-01-10 01:13:51 -06:00
|
|
|
|
2017-06-15 11:05:43 -04:00
|
|
|
rs := Client.Must(Client.Command(channel.Id, "/test posts fuzz 2 3 2")).Data.(*model.CommandResponse)
|
2016-04-25 05:39:02 -07:00
|
|
|
if rs.Text != "Added posts" {
|
2016-01-10 01:13:51 -06:00
|
|
|
t.Fatal(rs.Text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|