summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/store_test.go
blob: 605c73b6aed523d9cd7ae3513a4ea611fd6c4003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package sqlstore

import (
	"testing"

	"github.com/mattermost/mattermost-server/store"
	"github.com/mattermost/mattermost-server/utils"
)

var sqlStore store.Store

func StoreTest(t *testing.T, f func(*testing.T, store.Store)) {
	if sqlStore == nil {
		utils.TranslationsPreInit()
		utils.LoadConfig("config.json")
		utils.InitTranslations(utils.Cfg.LocalizationSettings)
		sqlStore = store.NewLayeredStore(NewSqlSupplier(nil), nil, nil)

		sqlStore.MarkSystemRanUnitTests()
	}
	f(t, sqlStore)
}