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
@@ -20,7 +20,7 @@ import (
|
||||
|
||||
func TestCreateBot(t *testing.T) {
|
||||
t.Run("create bot without permissions", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -137,7 +137,7 @@ func TestCreateBot(t *testing.T) {
|
||||
|
||||
func TestPatchBot(t *testing.T) {
|
||||
t.Run("patch non-existent bot", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -204,7 +204,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch someone else's bot without permission", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -1278,7 +1278,7 @@ func TestSetBotIconImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBotIconImage(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
@@ -1340,7 +1340,7 @@ func TestGetBotIconImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteBotIconImage(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
Ссылка в новой задаче
Block a user