Optimize CI test runtime
This PR makes 2 main changes to the tests: 1. User logins were a huge part of the total CPU time because of the constant hashing of the password. There were 3 logins every time for every `Setup()` call. We remove the `LoginSystemManager` from the Setup call as it wasn't used in a lot of tests, and call that as needed. 2. We add the new app migrations that got added after the last preload optimization was done. This shaves off around 3 mins from the test runtime. They are down from ~18m to ~15m. ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bd42f0cd8c
Коммит
696b9e0872
@@ -440,15 +440,11 @@ func (th *TestHelper) InitLogin() *TestHelper {
|
||||
th.SystemManagerUser.Password = "Pa$$word11"
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(3)
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
th.LoginSystemAdmin()
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
th.LoginSystemManager()
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
th.LoginTeamAdmin()
|
||||
wg.Done()
|
||||
@@ -527,10 +523,6 @@ func (th *TestHelper) CreateWebSocketSystemAdminClient() (*model.WebSocketClient
|
||||
return model.NewWebSocketClient4(fmt.Sprintf("ws://localhost:%v", th.App.Srv().ListenAddr.Port), th.SystemAdminClient.AuthToken)
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreateWebSocketSystemManagerClient() (*model.WebSocketClient, error) {
|
||||
return model.NewWebSocketClient4(fmt.Sprintf("ws://localhost:%v", th.App.Srv().ListenAddr.Port), th.SystemManagerClient.AuthToken)
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreateWebSocketClientWithClient(client *model.Client4) (*model.WebSocketClient, error) {
|
||||
return model.NewWebSocketClient4(fmt.Sprintf("ws://localhost:%v", th.App.Srv().ListenAddr.Port), client.AuthToken)
|
||||
}
|
||||
|
||||
@@ -1106,6 +1106,7 @@ func TestGetChannelsForUser(t *testing.T) {
|
||||
|
||||
func TestGetAllChannels(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -1473,6 +1474,7 @@ func TestSearchArchivedChannels(t *testing.T) {
|
||||
|
||||
func TestSearchAllChannels(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
func TestCreateJob(t *testing.T) {
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
|
||||
job := &model.Job{
|
||||
@@ -127,6 +128,7 @@ func TestGetJobs(t *testing.T) {
|
||||
|
||||
func TestGetJobsByType(t *testing.T) {
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
|
||||
jobType := model.JobTypeDataRetention
|
||||
@@ -191,6 +193,7 @@ func TestGetJobsByType(t *testing.T) {
|
||||
|
||||
func TestDownloadJob(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
jobName := model.NewId()
|
||||
job := &model.Job{
|
||||
|
||||
@@ -208,6 +208,7 @@ func TestEmailTest(t *testing.T) {
|
||||
|
||||
func TestGenerateSupportPacket(t *testing.T) {
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("As a System Administrator", func(t *testing.T) {
|
||||
|
||||
@@ -967,6 +967,7 @@ func TestPermanentDeleteTeam(t *testing.T) {
|
||||
|
||||
func TestGetAllTeams(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -1403,6 +1404,7 @@ func TestGetTeamByNameSanitization(t *testing.T) {
|
||||
|
||||
func TestSearchAllTeams(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
|
||||
oTeam := th.BasicTeam
|
||||
|
||||
89
testlib/testdata/mysql_migration_warmup.sql
поставляемый
89
testlib/testdata/mysql_migration_warmup.sql
поставляемый
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
76
testlib/testdata/postgres_migration_warmup.sql
поставляемый
76
testlib/testdata/postgres_migration_warmup.sql
поставляемый
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Ссылка в новой задаче
Block a user