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