grafana/pkg/infra/remotecache/testing.go
Jo 4ee389676e
RemoteCache: Cleanup infra remote cache (#64381)
* add warning on Count

* add usagestats service

* fix typo

* remove unused glog

* remote cache stats collect

* add encrypt usage stat

* rename handler

* Update pkg/infra/remotecache/remotecache.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update pkg/infra/remotecache/remotecache_test.go

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
2023-03-09 09:26:13 +01:00

32 lines
714 B
Go

package remotecache
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/usagestats"
"github.com/grafana/grafana/pkg/services/secrets/fakes"
"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, &usagestats.UsageStatsMock{}, fakes.NewFakeSecretsService())
require.NoError(t, err, "Failed to init remote cache for test")
return dc
}