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

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

@@ -30,6 +30,7 @@ import (
)
func TestGeneratePublicLinkHash(t *testing.T) {
mainHelper.Parallel(t)
filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
filename2 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
salt1 := model.NewRandomString(32)
@@ -48,6 +49,7 @@ func TestGeneratePublicLinkHash(t *testing.T) {
}
func TestDoUploadFile(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -109,6 +111,7 @@ func TestDoUploadFile(t *testing.T) {
}
func TestUploadFile(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -137,6 +140,7 @@ func TestUploadFile(t *testing.T) {
}
func TestParseOldFilenames(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -234,6 +238,7 @@ func TestParseOldFilenames(t *testing.T) {
}
func TestGetInfoForFilename(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -245,6 +250,7 @@ func TestGetInfoForFilename(t *testing.T) {
}
func TestFindTeamIdForFilename(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -259,6 +265,7 @@ func TestFindTeamIdForFilename(t *testing.T) {
}
func TestMigrateFilenamesToFileInfos(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -293,6 +300,7 @@ func TestMigrateFilenamesToFileInfos(t *testing.T) {
}
func TestCreateZipFileAndAddFiles(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -349,6 +357,7 @@ func TestCreateZipFileAndAddFiles(t *testing.T) {
}
func TestCopyFileInfos(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t)
defer th.TearDown()
@@ -380,6 +389,7 @@ func TestCopyFileInfos(t *testing.T) {
}
func TestGenerateThumbnailImage(t *testing.T) {
mainHelper.Parallel(t)
t.Run("test generating thumbnail image", func(t *testing.T) {
// given
th := Setup(t)
@@ -409,6 +419,7 @@ func createDummyImage() *image.RGBA {
}
func TestSearchFilesInTeamForUser(t *testing.T) {
mainHelper.Parallel(t)
perPage := 5
searchTerm := "searchTerm"
@@ -602,6 +613,7 @@ func TestSearchFilesInTeamForUser(t *testing.T) {
}
func TestExtractContentFromFileInfo(t *testing.T) {
mainHelper.Parallel(t)
app := &App{}
fi := &model.FileInfo{
MimeType: "image/jpeg",
@@ -612,6 +624,7 @@ func TestExtractContentFromFileInfo(t *testing.T) {
}
func TestGetLastAccessibleFileTime(t *testing.T) {
mainHelper.Parallel(t)
th := SetupWithStoreMock(t)
defer th.TearDown()
@@ -645,6 +658,7 @@ func TestGetLastAccessibleFileTime(t *testing.T) {
}
func TestComputeLastAccessibleFileTime(t *testing.T) {
mainHelper.Parallel(t)
t.Run("Updates the time, if cloud limit is applicable", func(t *testing.T) {
th := SetupWithStoreMock(t)
defer th.TearDown()
@@ -704,6 +718,7 @@ func TestComputeLastAccessibleFileTime(t *testing.T) {
}
func TestSetFileSearchableContent(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()
@@ -732,6 +747,7 @@ func TestSetFileSearchableContent(t *testing.T) {
}
func TestPermanentDeleteFilesByPost(t *testing.T) {
mainHelper.Parallel(t)
th := Setup(t).InitBasic()
defer th.TearDown()