Switch to Postgres when running tests and turn off the fsync setting (#13678)

* Run all tests fasts in postgres

* Moving postgres config to a file

* Addressing PR review comments

* Testing against mysql in the CI to keep things less changed

* Revert "Testing against mysql in the CI to keep things less changed"

This reverts commit fc940c111db269a821c54e005d76df87cb70e031.

* Fixing a test broken in postgres but working in mysql

* Fixing some tests

* Fixing some config tests with postgres

* Fixing the rest of config tests

* Fixing govet error

* Fixing search tests for postgres
Этот коммит содержится в:
Jesús Espino
2020-02-06 15:15:18 +01:00
коммит произвёл GitHub
родитель 55b646ecf8
Коммит 596f986755
11 изменённых файлов: 154 добавлений и 83 удалений

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

@@ -8,6 +8,7 @@ import (
"testing"
"github.com/go-sql-driver/mysql"
"github.com/lib/pq"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/testlib"
"github.com/stretchr/testify/require"
@@ -47,6 +48,14 @@ func truncateTable(t *testing.T, table string) {
case model.DATABASE_DRIVER_POSTGRES:
_, err := sqlSupplier.GetMaster().Db.Exec(fmt.Sprintf("TRUNCATE TABLE %s", table))
if err != nil {
if driverErr, ok := err.(*pq.Error); ok {
// Ignore if the Configurations table does not exist.
if driverErr.Code == "42P01" {
return
}
}
}
require.NoError(t, err)
default: