Enable products for tests (#22757)
* Enable products for channels tests * increase unit test timeout; check IsConfigReadOnly * make app-layers * Avoid loading boards tempaltes between tests to improve speed * Fix delete query to be compatible with both databases * Avoid preserving the templates for boards store tests * Run all tests in one command * Revert "Run all tests in one command" This reverts commit 0330f7cd8f96b47776770e8f80ba6ba18d98b8d1. * concurrent pkg group tests in CI * Revert "Revert "Run all tests in one command"" This reverts commit 73892fec772575ff054a99ba9e00a7b57ca74164. * Revert "concurrent pkg group tests in CI" This reverts commit 550fb6cdd4a7f14d9632f2626bc66f389173b5d9. * try testing 3 subsets of packages concurrently to improve time taken * Revert "try testing 3 subsets of packages concurrently to improve time taken" This reverts commit 97475f3c4eafa8bbe047097e0841220884f68cdc. --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: wiggin77 <wiggin77@warpmail.net>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a8d79ec3da
Коммит
067e36c23c
@@ -52,8 +52,8 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
}
|
||||
|
||||
configStore := config.NewTestMemoryStore()
|
||||
|
||||
memoryConfig := configStore.Get()
|
||||
memoryConfig.SqlSettings = *mainHelper.GetSQLSettings()
|
||||
*memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins")
|
||||
*memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp")
|
||||
*memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
@@ -138,7 +138,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
return th
|
||||
}
|
||||
|
||||
func Setup(tb testing.TB) *TestHelper {
|
||||
func Setup(tb testing.TB, options ...Option) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func Setup(tb testing.TB) *TestHelper {
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
return setupTestHelper(dbStore, false, true, nil, tb)
|
||||
return setupTestHelper(dbStore, false, true, options, tb)
|
||||
}
|
||||
|
||||
func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper {
|
||||
@@ -157,13 +157,16 @@ func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper {
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
// Only boards migrations are applied
|
||||
mainHelper.PreloadBoardsMigrationsIfNeeded()
|
||||
|
||||
return setupTestHelper(dbStore, false, true, nil, tb)
|
||||
}
|
||||
|
||||
func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
mockStore := testlib.GetMockStoreForSetupFunctions()
|
||||
th := setupTestHelper(mockStore, false, false, nil, tb)
|
||||
setupOptions := []Option{SkipProductsInitialization()}
|
||||
th := setupTestHelper(mockStore, false, false, setupOptions, tb)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -184,7 +187,8 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
|
||||
func SetupEnterpriseWithStoreMock(tb testing.TB) *TestHelper {
|
||||
mockStore := testlib.GetMockStoreForSetupFunctions()
|
||||
th := setupTestHelper(mockStore, true, false, nil, tb)
|
||||
setupOptions := []Option{SkipProductsInitialization()}
|
||||
th := setupTestHelper(mockStore, true, false, setupOptions, tb)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -249,6 +253,14 @@ func (th *TestHelper) InitBasic() *TestHelper {
|
||||
return th
|
||||
}
|
||||
|
||||
func (th *TestHelper) DeleteBots() *TestHelper {
|
||||
preexistingBots, _ := th.App.GetBots(&model.BotGetOptions{Page: 0, PerPage: 100})
|
||||
for _, bot := range preexistingBots {
|
||||
th.App.PermanentDeleteBot(bot.UserId)
|
||||
}
|
||||
return th
|
||||
}
|
||||
|
||||
func (*TestHelper) MakeEmail() string {
|
||||
return "success_" + model.NewId() + "@simulator.amazonses.com"
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user