mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 15:43:23 -06:00
67cbc7d4cf
Replaces session storage in auth_proxy middleware with remote cache Fixes #15161
35 lines
579 B
Go
35 lines
579 B
Go
package remotecache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
|
"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 := sqlstore.InitTestDB(t)
|
|
|
|
dc := &RemoteCache{
|
|
SQLStore: SQLStore,
|
|
Cfg: &setting.Cfg{
|
|
RemoteCacheOptions: opts,
|
|
},
|
|
}
|
|
|
|
err := dc.Init()
|
|
if err != nil {
|
|
t.Fatalf("failed to init remote cache for test. error: %v", err)
|
|
}
|
|
|
|
return dc
|
|
}
|