2d261fde59
* Adding mysql support * Fixing other test cases * Tests passing on mysql * Fix the row number generation * Adding blocks_history table * merging the migrations in one single set of files * Passing mysql tests * Fixing default encoding on mysql * Simplifying things * Removing from the blocks table all deleted blocks * Better indentation * Moving db types to constants to make it less error prone * reducing duplicated code * Removing log line * Now sql tests are running properly in mysql, sqlite and postgres
37 lines
889 B
Go
37 lines
889 B
Go
package sqlstore
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/mattermost/focalboard/server/services/store"
|
|
"github.com/mattermost/focalboard/server/services/store/storetests"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func SetupTests(t *testing.T) (store.Store, func()) {
|
|
dbType := os.Getenv("FB_STORE_TEST_DB_TYPE")
|
|
if dbType == "" {
|
|
dbType = sqliteDBType
|
|
}
|
|
|
|
connectionString := os.Getenv("FB_STORE_TEST_CONN_STRING")
|
|
if connectionString == "" {
|
|
connectionString = ":memory:"
|
|
}
|
|
|
|
store, err := New(dbType, connectionString, "test_")
|
|
require.Nil(t, err)
|
|
|
|
tearDown := func() {
|
|
err = store.Shutdown()
|
|
require.Nil(t, err)
|
|
}
|
|
|
|
return store, tearDown
|
|
}
|
|
|
|
func TestBlocksStore(t *testing.T) {
|
|
t.Run("BlocksStore", func(t *testing.T) { storetests.StoreTestBlocksStore(t, SetupTests) })
|
|
t.Run("SharingStore", func(t *testing.T) { storetests.StoreTestSharingStore(t, SetupTests) })
|
|
}
|