focalboard/server/services/store/sqlstore/sqlstore_test.go
Jesús Espino 2d261fde59
Adding mysql support to the database (#301)
* 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
2021-04-22 22:53:01 +02:00

38 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) })
}