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

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

@@ -38,6 +38,7 @@ func getLicWithSkuShortName(skuShortName string) *model.License {
}
func TestSendNotifications(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -217,6 +218,7 @@ func TestSendNotifications(t *testing.T) {
}
func TestSendNotifications_MentionsFollowers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -530,6 +532,7 @@ func connectFakeWebSocket(t *testing.T, th *TestHelper, userID string, connectio
}
func TestConnectFakeWebSocket(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -564,6 +567,7 @@ func TestConnectFakeWebSocket(t *testing.T) {
}
func TestSendNotificationsWithManyUsers(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -618,6 +622,7 @@ func TestSendNotificationsWithManyUsers(t *testing.T) {
}
func TestSendOutOfChannelMentions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -659,6 +664,7 @@ func TestSendOutOfChannelMentions(t *testing.T) {
}
func TestFilterOutOfChannelMentions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -852,6 +858,7 @@ func TestFilterOutOfChannelMentions(t *testing.T) {
}
func TestGetExplicitMentions(t *testing.T) {
mainHelper.Parallel(t)
id1 := model.NewId()
id2 := model.NewId()
id3 := model.NewId()
@@ -1440,6 +1447,7 @@ func TestGetExplicitMentions(t *testing.T) {
}
func TestGetExplicitMentionsAtHere(t *testing.T) {
mainHelper.Parallel(t)
t.Run("Boundary cases", func(t *testing.T) {
// test all the boundary cases that we know can break up terms (and those that we know won't)
cases := map[string]bool{
@@ -1516,6 +1524,7 @@ func TestGetExplicitMentionsAtHere(t *testing.T) {
}
func TestAllowChannelMentions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -1554,6 +1563,7 @@ func TestAllowChannelMentions(t *testing.T) {
}
func TestAllowGroupMentions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -1612,6 +1622,7 @@ func TestAllowGroupMentions(t *testing.T) {
}
func TestGetMentionKeywords(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -1937,6 +1948,7 @@ func TestGetMentionKeywords(t *testing.T) {
}
func TestGetMentionKeywords_Groups(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -2186,6 +2198,7 @@ func TestGetMentionKeywords_Groups(t *testing.T) {
}
func TestGetMentionsEnabledFields(t *testing.T) {
mainHelper.Parallel(t)
attachmentWithTextAndPreText := model.SlackAttachment{
Text: "@here with mentions",
Pretext: "@Channel some comment for the channel",
@@ -2225,6 +2238,7 @@ func TestGetMentionsEnabledFields(t *testing.T) {
}
func TestPostNotificationGetChannelName(t *testing.T) {
mainHelper.Parallel(t)
sender := &model.User{Id: model.NewId(), Username: "sender", FirstName: "Sender", LastName: "Sender", Nickname: "Sender"}
recipient := &model.User{Id: model.NewId(), Username: "recipient", FirstName: "Recipient", LastName: "Recipient", Nickname: "Recipient"}
otherUser := &model.User{Id: model.NewId(), Username: "other", FirstName: "Other", LastName: "Other", Nickname: "Other"}
@@ -2307,6 +2321,7 @@ func TestPostNotificationGetChannelName(t *testing.T) {
}
func TestPostNotificationGetSenderName(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -2411,6 +2426,7 @@ func TestPostNotificationGetSenderName(t *testing.T) {
}
func TestGetNotificationNameFormat(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -2434,6 +2450,7 @@ func TestGetNotificationNameFormat(t *testing.T) {
}
func TestUserAllowsEmail(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -2544,6 +2561,7 @@ func TestUserAllowsEmail(t *testing.T) {
}
func TestInsertGroupMentions(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -2678,6 +2696,7 @@ func TestInsertGroupMentions(t *testing.T) {
}
func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -2803,6 +2822,7 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
}
func TestReplyPostNotificationsWithCRT(t *testing.T) {
mainHelper.Parallel(t)
t.Run("Reply posts only shows badges for explicit mentions in collapsed threads", func(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -2959,6 +2979,7 @@ func TestReplyPostNotificationsWithCRT(t *testing.T) {
}
func TestChannelAutoFollowThreads(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -3022,6 +3043,7 @@ func TestChannelAutoFollowThreads(t *testing.T) {
}
func TestRemoveNotifications(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -3135,6 +3157,7 @@ func TestRemoveNotifications(t *testing.T) {
}
func TestShouldAckWebsocketNotification(t *testing.T) {
mainHelper.Parallel(t)
t.Run("should return true if channel notify level is ALL", func(t *testing.T) {
assert.True(t, shouldAckWebsocketNotification(model.ChannelTypeOpen, model.UserNotifyNone, model.ChannelNotifyAll))
})