focalboard/server/services/store/sqlstore/sqlstore_test.go

43 lines
1.1 KiB
Go
Raw Normal View History

package sqlstore
import (
"os"
"testing"
"github.com/mattermost/focalboard/server/services/mlog"
"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()) {
2021-04-17 09:06:57 +02:00
dbType := os.Getenv("FB_STORE_TEST_DB_TYPE")
if dbType == "" {
dbType = sqliteDBType
}
2021-04-17 09:06:57 +02:00
connectionString := os.Getenv("FB_STORE_TEST_CONN_STRING")
if connectionString == "" {
connectionString = ":memory:"
}
logger := mlog.CreateTestLogger(t)
store, err := New(dbType, connectionString, "test_", logger)
require.Nil(t, err)
tearDown := func() {
defer logger.Shutdown()
2020-10-18 02:07:35 +02:00
err = store.Shutdown()
require.Nil(t, err)
}
return store, tearDown
}
2020-11-12 19:48:08 +01:00
func TestBlocksStore(t *testing.T) {
t.Run("BlocksStore", func(t *testing.T) { storetests.StoreTestBlocksStore(t, SetupTests) })
2021-01-29 20:27:43 +01:00
t.Run("SharingStore", func(t *testing.T) { storetests.StoreTestSharingStore(t, SetupTests) })
2021-04-30 16:48:45 +02:00
t.Run("SystemStore", func(t *testing.T) { storetests.StoreTestSystemStore(t, SetupTests) })
2020-11-12 19:48:08 +01:00
}