3c86bf550e
* add encryption codec to the remote cache
* change config files too
* fix test constructor
* pass codec into the test cache
(cherry picked from commit f1fb202284)
30 lines
647 B
Go
30 lines
647 B
Go
package remotecache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/services/secrets/fakes"
|
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// NewFakeStore creates store for testing
|
|
func NewFakeStore(t *testing.T) *RemoteCache {
|
|
t.Helper()
|
|
|
|
opts := &setting.RemoteCacheOptions{
|
|
Name: "database",
|
|
ConnStr: "",
|
|
}
|
|
|
|
sqlStore := sqlstore.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
|
|
}
|