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
@@ -993,6 +993,7 @@ func (ss *SqlStore) TrueUpReview() store.TrueUpReviewStore {
|
||||
}
|
||||
|
||||
func (ss *SqlStore) DropAllTables() {
|
||||
var tableSchemaFn string
|
||||
if ss.DriverName() == model.DatabaseDriverPostgres {
|
||||
ss.masterX.Exec(`DO
|
||||
$func$
|
||||
@@ -1002,18 +1003,57 @@ func (ss *SqlStore) DropAllTables() {
|
||||
FROM pg_class
|
||||
WHERE relkind = 'r' -- only tables
|
||||
AND relnamespace = 'public'::regnamespace
|
||||
AND NOT relname = 'db_migrations'
|
||||
AND NOT (
|
||||
relname = 'db_migrations' OR
|
||||
relname = 'focalboard_schema_migrations' OR
|
||||
relname = 'focalboard_boards' OR
|
||||
relname = 'focalboard_blocks'
|
||||
)
|
||||
);
|
||||
END
|
||||
$func$;`)
|
||||
tableSchemaFn = "current_schema()"
|
||||
} else {
|
||||
tables := []string{}
|
||||
ss.masterX.Select(&tables, `show tables`)
|
||||
for _, t := range tables {
|
||||
if t != "db_migrations" {
|
||||
if t != "db_migrations" &&
|
||||
t != "focalboard_schema_migrations" &&
|
||||
t != "focalboard_boards" &&
|
||||
t != "focalboard_blocks" {
|
||||
ss.masterX.Exec(`TRUNCATE TABLE ` + t)
|
||||
|
||||
}
|
||||
}
|
||||
tableSchemaFn = "DATABASE()"
|
||||
}
|
||||
|
||||
var boardsTableCount int
|
||||
err := ss.masterX.Get(&boardsTableCount, `
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = `+tableSchemaFn+`
|
||||
AND TABLE_NAME = 'focalboard_schema_migrations'`)
|
||||
if err != nil {
|
||||
panic(errors.Wrap(err, "Error dropping all tables. Cannot query INFORMATION_SCHEMA table to check for focalboard_schema_migrations table"))
|
||||
}
|
||||
|
||||
if boardsTableCount != 0 {
|
||||
_, blErr := ss.masterX.Exec(`
|
||||
DELETE FROM focalboard_blocks
|
||||
WHERE board_id IN (
|
||||
SELECT id
|
||||
FROM focalboard_boards
|
||||
WHERE NOT is_template
|
||||
)`)
|
||||
if blErr != nil {
|
||||
panic(errors.Wrap(blErr, "Error deleting all non-template blocks"))
|
||||
}
|
||||
|
||||
_, boErr := ss.masterX.Exec(`DELETE FROM focalboard_boards WHERE NOT is_template`)
|
||||
if boErr != nil {
|
||||
panic(errors.Wrap(boErr, "Error delegint all non-template boards"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user