2019-04-08 06:31:46 -05:00
|
|
|
package remotecache
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-12-02 05:44:51 -06:00
|
|
|
"github.com/stretchr/testify/require"
|
2022-10-19 08:02:15 -05:00
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/infra/db"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
2019-04-08 06:31:46 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// NewFakeStore creates store for testing
|
|
|
|
func NewFakeStore(t *testing.T) *RemoteCache {
|
|
|
|
t.Helper()
|
|
|
|
|
|
|
|
opts := &setting.RemoteCacheOptions{
|
|
|
|
Name: "database",
|
|
|
|
ConnStr: "",
|
|
|
|
}
|
|
|
|
|
2022-10-19 08:02:15 -05:00
|
|
|
sqlStore := db.InitTestDB(t)
|
2019-04-08 06:31:46 -05:00
|
|
|
|
2021-08-25 08:11:22 -05:00
|
|
|
dc, err := ProvideService(&setting.Cfg{
|
|
|
|
RemoteCacheOptions: opts,
|
|
|
|
}, sqlStore)
|
2020-12-02 05:44:51 -06:00
|
|
|
require.NoError(t, err, "Failed to init remote cache for test")
|
2019-04-08 06:31:46 -05:00
|
|
|
|
|
|
|
return dc
|
|
|
|
}
|