[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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1cf2f08108
Коммит
611b2a8e79
@@ -28,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
func TestReactionsOfPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -58,6 +59,7 @@ func TestReactionsOfPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserNotifyProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -85,6 +87,7 @@ func TestExportUserNotifyProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -136,6 +139,7 @@ func TestExportUserChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopyEmojiImages(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -172,6 +176,7 @@ func TestCopyEmojiImages(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportCustomEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -192,6 +197,7 @@ func TestExportCustomEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportAllUsers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t)
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -204,8 +210,15 @@ func TestExportAllUsers(t *testing.T) {
|
||||
err = th1.App.BulkExport(th1.Context, &b, "somePath", nil, model.BulkExportOpts{})
|
||||
require.Nil(t, err)
|
||||
|
||||
th2 := Setup(t)
|
||||
defer th2.TearDown()
|
||||
var th2 *TestHelper
|
||||
if mainHelper.Options.RunParallel {
|
||||
th1.Store.DropAllTables()
|
||||
th2 = th1
|
||||
} else {
|
||||
th2 = Setup(t)
|
||||
defer th2.TearDown()
|
||||
}
|
||||
|
||||
i, err := th2.App.BulkImport(th2.Context, &b, nil, false, 5)
|
||||
assert.Nil(t, err)
|
||||
assert.EqualValues(t, 0, i)
|
||||
@@ -241,6 +254,7 @@ func TestExportAllUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportAllBots(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t)
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -276,6 +290,7 @@ func TestExportAllBots(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Export a DM channel to another server", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
@@ -406,6 +421,7 @@ func TestExportDMChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMChannelToSelf(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -440,6 +456,7 @@ func TestExportDMChannelToSelf(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportGMChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
user1 := th1.CreateUser()
|
||||
@@ -469,6 +486,7 @@ func TestExportGMChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportGMandDMChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel
|
||||
@@ -516,6 +534,7 @@ func TestExportGMandDMChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMandGMPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel
|
||||
@@ -600,6 +619,7 @@ func TestExportDMandGMPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportPostWithProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
attachments := []*model.SlackAttachment{{Footer: "footer"}}
|
||||
@@ -677,6 +697,7 @@ func TestExportPostWithProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserCustomStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
cs := &model.CustomStatus{
|
||||
@@ -711,6 +732,7 @@ func TestExportUserCustomStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMPostWithSelf(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel with self (me channel)
|
||||
@@ -748,6 +770,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportPostsWithThread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -985,6 +1008,7 @@ func TestExportFileWarnings(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBulkExport(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
testsDir, _ := fileutils.FindDir("tests")
|
||||
|
||||
@@ -1039,6 +1063,7 @@ func TestBulkExport(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBuildPostReplies(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1103,6 +1128,7 @@ func TestBuildPostReplies(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDeletedTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -1118,8 +1144,15 @@ func TestExportDeletedTeams(t *testing.T) {
|
||||
err = th1.App.BulkExport(th1.Context, &b, "somePath", nil, model.BulkExportOpts{})
|
||||
require.Nil(t, err)
|
||||
|
||||
th2 := Setup(t)
|
||||
defer th2.TearDown()
|
||||
var th2 *TestHelper
|
||||
if mainHelper.Options.RunParallel {
|
||||
th1.Store.DropAllTables()
|
||||
th2 = th1
|
||||
} else {
|
||||
th2 = Setup(t)
|
||||
defer th2.TearDown()
|
||||
}
|
||||
|
||||
i, err := th2.App.BulkImport(th2.Context, &b, nil, false, 5)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 0, i)
|
||||
@@ -1144,6 +1177,7 @@ func TestExportDeletedTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportArchivedChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -1179,6 +1213,7 @@ func TestExportArchivedChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("defaults", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
@@ -1277,6 +1312,7 @@ func TestExportRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportSchemes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("no schemes", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user