[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 удалений

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

@@ -27,6 +27,7 @@ import (
)
func TestCreateChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -203,6 +204,7 @@ func TestCreateChannel(t *testing.T) {
}
func TestUpdateChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -378,6 +380,7 @@ func TestUpdateChannel(t *testing.T) {
}
func TestPatchChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1164,6 +1167,7 @@ func TestCanEditChannelBanner(t *testing.T) {
}
func TestChannelUnicodeNames(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1223,6 +1227,7 @@ func TestChannelUnicodeNames(t *testing.T) {
}
func TestCreateDirectChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1285,6 +1290,7 @@ func TestCreateDirectChannel(t *testing.T) {
}
func TestCreateDirectChannelAsGuest(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1333,6 +1339,7 @@ func TestCreateDirectChannelAsGuest(t *testing.T) {
}
func TestDeleteDirectChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1349,6 +1356,7 @@ func TestDeleteDirectChannel(t *testing.T) {
}
func TestCreateGroupChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1411,6 +1419,7 @@ func TestCreateGroupChannel(t *testing.T) {
}
func TestCreateGroupChannelAsGuest(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1478,6 +1487,7 @@ func TestCreateGroupChannelAsGuest(t *testing.T) {
}
func TestDeleteGroupChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
user := th.BasicUser
@@ -1497,6 +1507,7 @@ func TestDeleteGroupChannel(t *testing.T) {
}
func TestGetChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1547,6 +1558,7 @@ func TestGetChannel(t *testing.T) {
}
func TestGetDeletedChannelsForTeam(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -1622,6 +1634,7 @@ func TestGetDeletedChannelsForTeam(t *testing.T) {
}
func TestGetPrivateChannelsForTeam(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
team := th.BasicTeam
@@ -1660,6 +1673,7 @@ func TestGetPrivateChannelsForTeam(t *testing.T) {
}
func TestGetPublicChannelsForTeam(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1736,6 +1750,7 @@ func TestGetPublicChannelsForTeam(t *testing.T) {
}
func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1793,6 +1808,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
}
func TestGetChannelsForTeamForUser(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -1873,6 +1889,7 @@ func TestGetChannelsForTeamForUser(t *testing.T) {
}
func TestGetChannelsForUser(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -1925,6 +1942,7 @@ func TestGetChannelsForUser(t *testing.T) {
}
func TestGetAllChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
th.LoginSystemManager()
defer th.TearDown()
@@ -2086,6 +2104,7 @@ func TestGetAllChannels(t *testing.T) {
}
func TestGetAllChannelsWithCount(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2118,6 +2137,7 @@ func TestGetAllChannelsWithCount(t *testing.T) {
}
func TestSearchChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2251,6 +2271,7 @@ func TestSearchChannels(t *testing.T) {
}
func TestSearchArchivedChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2341,6 +2362,7 @@ func TestSearchArchivedChannels(t *testing.T) {
}
func TestSearchAllChannels(t *testing.T) {
mainHelper.Parallel(t)
th := setupForSharedChannels(t).InitBasic()
th.LoginSystemManager()
defer th.TearDown()
@@ -2631,6 +2653,7 @@ func TestSearchAllChannels(t *testing.T) {
}
func TestSearchAllChannelsPaged(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2650,6 +2673,7 @@ func TestSearchAllChannelsPaged(t *testing.T) {
}
func TestSearchGroupChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2718,6 +2742,7 @@ func TestSearchGroupChannels(t *testing.T) {
}
func TestDeleteChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
c := th.Client
@@ -2806,6 +2831,7 @@ func TestDeleteChannel(t *testing.T) {
}
func TestDeleteChannel2(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -2885,6 +2911,7 @@ func TestDeleteChannel2(t *testing.T) {
}
func TestPermanentDeleteChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -2923,6 +2950,7 @@ func TestPermanentDeleteChannel(t *testing.T) {
}
func TestUpdateChannelPrivacy(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -3017,6 +3045,7 @@ func TestUpdateChannelPrivacy(t *testing.T) {
}
func TestRestoreChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -3075,6 +3104,7 @@ func TestRestoreChannel(t *testing.T) {
}
func TestGetChannelByName(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3140,6 +3170,7 @@ func TestGetChannelByName(t *testing.T) {
}
func TestGetChannelByNameForTeamName(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3201,6 +3232,7 @@ func TestGetChannelByNameForTeamName(t *testing.T) {
}
func TestGetChannelMembers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
th.TestForAllClients(t, func(t *testing.T, client *model.Client4) {
@@ -3249,6 +3281,7 @@ func TestGetChannelMembers(t *testing.T) {
}
func TestGetChannelMembersByIds(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3291,6 +3324,7 @@ func TestGetChannelMembersByIds(t *testing.T) {
}
func TestGetChannelMember(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
c := th.Client
@@ -3340,6 +3374,7 @@ func TestGetChannelMember(t *testing.T) {
}
func TestGetChannelMembersForUser(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3388,6 +3423,7 @@ func TestGetChannelMembersForUser(t *testing.T) {
}
func TestViewChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3466,6 +3502,7 @@ func TestViewChannel(t *testing.T) {
}
func TestReadMultipleChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3545,6 +3582,7 @@ func TestReadMultipleChannels(t *testing.T) {
}
func TestGetChannelUnread(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3593,6 +3631,7 @@ func TestGetChannelUnread(t *testing.T) {
}
func TestGetChannelStats(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3651,6 +3690,7 @@ func TestGetChannelStats(t *testing.T) {
}
func TestGetPinnedPosts(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3687,6 +3727,7 @@ func TestGetPinnedPosts(t *testing.T) {
}
func TestUpdateChannelRoles(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3766,6 +3807,7 @@ func TestUpdateChannelRoles(t *testing.T) {
}
func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -3920,6 +3962,7 @@ func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
}
func TestUpdateChannelNotifyProps(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -3965,6 +4008,7 @@ func TestUpdateChannelNotifyProps(t *testing.T) {
}
func TestAddChannelMember(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -4183,6 +4227,7 @@ func TestAddChannelMember(t *testing.T) {
}
func TestAddChannelMembers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -4213,6 +4258,7 @@ func TestAddChannelMembers(t *testing.T) {
}
func TestAddChannelMemberFromThread(t *testing.T) {
mainHelper.Parallel(t)
t.Skip("MM-41285")
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -4334,6 +4380,7 @@ func TestAddChannelMemberGuestAccessControl(t *testing.T) {
}
func TestAddChannelMemberAddMyself(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -4409,6 +4456,7 @@ func TestAddChannelMemberAddMyself(t *testing.T) {
}
func TestRemoveChannelMember(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
user1 := th.BasicUser
user2 := th.BasicUser2
@@ -4629,6 +4677,7 @@ func TestRemoveChannelMember(t *testing.T) {
}
func TestAutocompleteChannels(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -4697,6 +4746,7 @@ func TestAutocompleteChannels(t *testing.T) {
}
func TestAutocompleteChannelsForSearch(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -4810,6 +4860,7 @@ func TestAutocompleteChannelsForSearch(t *testing.T) {
}
func TestAutocompleteChannelsForSearchGuestUsers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -4939,6 +4990,7 @@ func TestAutocompleteChannelsForSearchGuestUsers(t *testing.T) {
}
func TestUpdateChannelScheme(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -5022,6 +5074,7 @@ func TestUpdateChannelScheme(t *testing.T) {
}
func TestGetChannelMembersTimezones(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
client := th.Client
@@ -5065,6 +5118,7 @@ func TestGetChannelMembersTimezones(t *testing.T) {
}
func TestChannelMembersMinusGroupMembers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5159,6 +5213,7 @@ func TestChannelMembersMinusGroupMembers(t *testing.T) {
}
func TestGetChannelModerations(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5373,6 +5428,7 @@ func TestGetChannelModerations(t *testing.T) {
}
func TestPatchChannelModerations(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5557,6 +5613,7 @@ func TestPatchChannelModerations(t *testing.T) {
}
func TestGetChannelMemberCountsByGroup(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5649,6 +5706,7 @@ func TestGetChannelMemberCountsByGroup(t *testing.T) {
}
func TestGetChannelsMemberCount(t *testing.T) {
mainHelper.Parallel(t)
// Setup
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5733,6 +5791,7 @@ func TestGetChannelsMemberCount(t *testing.T) {
}
func TestMoveChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5864,6 +5923,7 @@ func TestMoveChannel(t *testing.T) {
}
func TestRootMentionsCount(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -5905,6 +5965,7 @@ func TestRootMentionsCount(t *testing.T) {
}
func TestViewChannelWithoutCollapsedThreads(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()