mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-18 09:35:25 +02:00
31 lines
520 B
Go
31 lines
520 B
Go
package sqlstore
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func SetupTests(t *testing.T) (*SQLStore, func()) {
|
|
dbType := os.Getenv("OT_STORE_TEST_DB_TYPE")
|
|
if dbType == "" {
|
|
dbType = "sqlite3"
|
|
}
|
|
|
|
connectionString := os.Getenv("OT_STORE_TEST_CONN_STRING")
|
|
if connectionString == "" {
|
|
connectionString = ":memory:"
|
|
}
|
|
|
|
store, err := New(dbType, connectionString)
|
|
require.Nil(t, err)
|
|
|
|
tearDown := func() {
|
|
err = store.Shutdown()
|
|
require.Nil(t, err)
|
|
}
|
|
|
|
return store, tearDown
|
|
}
|