grafana/pkg/infra/remotecache/testing.go
Serge Zaitsev f1fb202284
Chore: Add encryption codec to the remote cache (#59871)
* add encryption codec to the remote cache

* change config files too

* fix test constructor

* pass codec into the test cache
2022-12-06 15:12:27 +01:00

31 lines
633 B
Go

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