[MM-62408] Server Code Coverage with Fully Parallel Tests (#30078)

* TestPool

* Store infra

* Store tests updates

* Bump maximum concurrent postgres connections

* More infra

* channels/jobs

* channels/app

* channels/api4

* Protect i18n from concurrent access

* Replace some use of os.Setenv

* Remove debug

* Lint fixes

* Fix more linting

* Fix test

* Remove use of Setenv in drafts tests

* Fix flaky TestWebHubCloseConnOnDBFail

* Fix merge

* [MM-62408] Add CI job to generate test coverage (#30284)

* Add CI job to generate test coverage

* Remove use of Setenv in drafts tests

* Fix flaky TestWebHubCloseConnOnDBFail

* Fix more Setenv usage

* Fix more potential flakyness

* Remove parallelism from flaky test

* Remove conflicting env var

* Fix

* Disable parallelism

* Test atomic covermode

* Disable parallelism

* Enable parallelism

* Add upload coverage step

* Fix codecov.yml

* Add codecov.yml

* Remove redundant workspace field

* Add Parallel() util methods and refactor

* Fix formatting

* More formatting fixes

* Fix reporting
Этот коммит содержится в:
Claudio Costa
2025-05-30 05:58:26 -06:00
коммит произвёл GitHub
родитель 1cf2f08108
Коммит 611b2a8e79
191 изменённых файлов: 2719 добавлений и 496 удалений

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

@@ -20,6 +20,7 @@ import (
)
func TestCreateCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -36,7 +37,8 @@ func TestCreateCommand(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "trigger"}
Trigger: "trigger",
}
_, resp, err := client.CreateCommand(context.Background(), newCmd)
require.Error(t, err)
@@ -82,6 +84,7 @@ func TestCreateCommand(t *testing.T) {
}
func TestUpdateCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
user := th.SystemAdminUser
@@ -161,6 +164,7 @@ func TestUpdateCommand(t *testing.T) {
}
func TestMoveCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
user := th.SystemAdminUser
@@ -219,6 +223,7 @@ func TestMoveCommand(t *testing.T) {
}
func TestDeleteCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
user := th.SystemAdminUser
@@ -277,6 +282,7 @@ func TestDeleteCommand(t *testing.T) {
}
func TestListCommands(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -292,7 +298,8 @@ func TestListCommands(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "custom_command"}
Trigger: "custom_command",
}
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
require.NoError(t, err)
@@ -372,6 +379,7 @@ func TestListCommands(t *testing.T) {
}
func TestListAutocompleteCommands(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -381,7 +389,8 @@ func TestListAutocompleteCommands(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "custom_command"}
Trigger: "custom_command",
}
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
require.NoError(t, err)
@@ -441,6 +450,7 @@ func TestListAutocompleteCommands(t *testing.T) {
}
func TestListCommandAutocompleteSuggestions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -450,7 +460,8 @@ func TestListCommandAutocompleteSuggestions(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "custom_command"}
Trigger: "custom_command",
}
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
require.NoError(t, err)
@@ -533,6 +544,7 @@ func TestListCommandAutocompleteSuggestions(t *testing.T) {
}
func TestGetCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -547,7 +559,8 @@ func TestGetCommand(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "roger"}
Trigger: "roger",
}
newCmd, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
require.NoError(t, err)
@@ -594,6 +607,7 @@ func TestGetCommand(t *testing.T) {
}
func TestRegenToken(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -609,7 +623,8 @@ func TestRegenToken(t *testing.T) {
TeamId: th.BasicTeam.Id,
URL: "http://nowhere.com",
Method: model.CommandMethodPost,
Trigger: "trigger"}
Trigger: "trigger",
}
createdCmd, resp, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
require.NoError(t, err)
@@ -626,6 +641,7 @@ func TestRegenToken(t *testing.T) {
}
func TestExecuteInvalidCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -696,6 +712,7 @@ func TestExecuteInvalidCommand(t *testing.T) {
}
func TestExecuteGetCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -758,6 +775,7 @@ func TestExecuteGetCommand(t *testing.T) {
}
func TestExecutePostCommand(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -818,6 +836,7 @@ func TestExecutePostCommand(t *testing.T) {
}
func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -871,6 +890,7 @@ func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
}
func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -927,6 +947,7 @@ func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
}
func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -991,6 +1012,7 @@ func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
}
func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1067,6 +1089,7 @@ func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
}
func TestExecuteCommandReadOnly(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client