MM-27149: optimize initBasic (#15063)
* MM-27149: optimize initBasic Mostly, all tests just needed the user initialization part and not the channel and group creation. So we move the user initialization inside the Setup call. This avoids unnecessary DB calls which take around 250-300ms on average. And we make the login requests concurrently to shave off a few more ms. According to my tests, the 2 login calls take 140 ms on average, which shaves off 70ms. So approximately, we shave off 350ms per test. And there are 114 occurences of these. So around 39 seconds. * make initlogin only for Setup/SetupEnterprise Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
30bd506e76
Коммит
4a2715974d
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestCreateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTeamSanitization(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
// Non-admin users can create a team, but they become a team admin by doing so
|
||||
@@ -253,7 +253,7 @@ func TestGetTeamUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.TestForAllClients(t, func(t *testing.T, client *model.Client4) {
|
||||
@@ -351,7 +351,7 @@ func TestUpdateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamSanitization(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -470,7 +470,7 @@ func TestPatchTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -539,7 +539,7 @@ func TestRestoreTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchTeamSanitization(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -571,7 +571,7 @@ func TestPatchTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamPrivacy(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -648,7 +648,7 @@ func TestUpdateTeamPrivacy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamUnicodeNames(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -715,7 +715,7 @@ func TestTeamUnicodeNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenerateTeamInviteId(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -770,7 +770,7 @@ func TestSoftDeleteTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
enableAPITeamDeletion := *th.App.Config().ServiceSettings.EnableAPITeamDeletion
|
||||
@@ -987,7 +987,7 @@ func TestGetAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllTeamsSanitization(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -1210,7 +1210,7 @@ func TestSearchAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
commonRandom := model.NewId()
|
||||
teams := [3]*model.Team{}
|
||||
@@ -3044,7 +3044,7 @@ func TestRemoveTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamScheme(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Srv().SetLicense(model.NewTestLicense(""))
|
||||
|
||||
Ссылка в новой задаче
Block a user