* 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>
Этот коммит содержится в:
Agniva De Sarker
2020-07-22 13:50:33 +05:30
коммит произвёл GitHub
родитель 30bd506e76
Коммит 4a2715974d
24 изменённых файлов: 137 добавлений и 119 удалений

Просмотреть файл

@@ -15,7 +15,7 @@ import (
)
func TestGetGroup(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
id := model.NewId()
@@ -60,7 +60,7 @@ func TestGetGroup(t *testing.T) {
}
func TestPatchGroup(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
id := model.NewId()
@@ -408,7 +408,7 @@ func TestGetGroupChannel(t *testing.T) {
}
func TestGetGroupTeams(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
id := model.NewId()
@@ -1073,7 +1073,7 @@ func TestGetGroupStats(t *testing.T) {
}
func TestGetGroupsGroupConstrainedParentTeam(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
th.App.Srv().SetLicense(model.NewTestLicense("ldap"))