mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
* chore: add alias for InitTestDB and Session Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store. * next pass of removing sqlstore imports * last little bit * remove mockstore where possible
30 lines
545 B
Go
30 lines
545 B
Go
package remotecache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/db"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
// NewFakeStore creates store for testing
|
|
func NewFakeStore(t *testing.T) *RemoteCache {
|
|
t.Helper()
|
|
|
|
opts := &setting.RemoteCacheOptions{
|
|
Name: "database",
|
|
ConnStr: "",
|
|
}
|
|
|
|
sqlStore := db.InitTestDB(t)
|
|
|
|
dc, err := ProvideService(&setting.Cfg{
|
|
RemoteCacheOptions: opts,
|
|
}, sqlStore)
|
|
require.NoError(t, err, "Failed to init remote cache for test")
|
|
|
|
return dc
|
|
}
|