Users: Use Remote Cache for storing signed in users [v9.3.x] (#59883) (#59934)

* FeatureToggle: for storing signed in user object in a Remote Cache (#59883)

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Gabriel MABILLE
2022-12-07 11:04:41 +01:00
committed by GitHub
parent a32d25bbe3
commit 3adad3c21a
12 changed files with 107 additions and 16 deletions
+24 -6
View File
@@ -393,7 +393,10 @@ func TestGetOrgUsersAPIEndpoint_AccessControlMetadata(t *testing.T) {
var err error
sc := setupHTTPServerWithCfg(t, false, cfg, func(hs *HTTPServer) {
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg), localcache.ProvideService(), quotatest.New(false, nil))
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg),
localcache.ProvideService(), quotatest.New(false, nil),
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
hs.orgService, err = orgimpl.ProvideService(hs.SQLStore, cfg, quotatest.New(false, nil))
require.NoError(t, err)
@@ -500,7 +503,10 @@ func TestGetOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
sc := setupHTTPServerWithCfg(t, false, cfg, func(hs *HTTPServer) {
quotaService := quotatest.New(false, nil)
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg), localcache.ProvideService(), quotaService)
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg),
localcache.ProvideService(), quotaService,
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
hs.orgService, err = orgimpl.ProvideService(hs.SQLStore, cfg, quotaService)
require.NoError(t, err)
@@ -607,7 +613,10 @@ func TestPostOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
var err error
sc := setupHTTPServerWithCfg(t, false, cfg, func(hs *HTTPServer) {
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg), localcache.ProvideService(), quotatest.New(false, nil))
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg),
localcache.ProvideService(), quotatest.New(false, nil),
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
})
@@ -727,7 +736,10 @@ func TestOrgUsersAPIEndpointWithSetPerms_AccessControl(t *testing.T) {
sc := setupHTTPServer(t, true, func(hs *HTTPServer) {
hs.tempUserService = tempuserimpl.ProvideService(hs.SQLStore)
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, setting.NewCfg(), teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), setting.NewCfg()), localcache.ProvideService(), quotatest.New(false, nil))
hs.SQLStore, nil, setting.NewCfg(), teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore),
setting.NewCfg()), localcache.ProvideService(), quotatest.New(false, nil),
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
})
setInitCtxSignedInViewer(sc.initCtx)
@@ -847,7 +859,10 @@ func TestPatchOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
sc := setupHTTPServerWithCfg(t, false, cfg, func(hs *HTTPServer) {
quotaService := quotatest.New(false, nil)
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg), localcache.ProvideService(), quotaService)
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg),
localcache.ProvideService(), quotaService,
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
hs.orgService, err = orgimpl.ProvideService(hs.SQLStore, cfg, quotaService)
require.NoError(t, err)
@@ -977,7 +992,10 @@ func TestDeleteOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
sc := setupHTTPServerWithCfg(t, false, cfg, func(hs *HTTPServer) {
quotaService := quotatest.New(false, nil)
hs.userService, err = userimpl.ProvideService(
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg), localcache.ProvideService(), quotaService)
hs.SQLStore, nil, cfg, teamimpl.ProvideService(hs.SQLStore.(*sqlstore.SQLStore), cfg),
localcache.ProvideService(), quotaService,
nil, featuremgmt.WithFeatures(),
)
require.NoError(t, err)
hs.orgService, err = orgimpl.ProvideService(hs.SQLStore, cfg, quotaService)
require.NoError(t, err)