mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 07:02:22 +08:00
Caching: Consolidate resource cache checking and updating in plugin middleware (#67002)
* Update the HandleResourceRequest function to mimic the HandleQueryRequest function * Remove CacheResourceResponse function from interface * revert additional thing I missed
This commit is contained in:
@ -30,9 +30,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/store"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/caching"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/org/orgtest"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginaccesscontrol"
|
||||
@ -373,11 +371,9 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
|
||||
func TestMakePluginResourceRequest(t *testing.T) {
|
||||
hs := HTTPServer{
|
||||
Cfg: setting.NewCfg(),
|
||||
log: log.New(),
|
||||
pluginClient: &fakePluginClient{},
|
||||
cachingService: &caching.OSSCachingService{},
|
||||
Features: &featuremgmt.FeatureManager{},
|
||||
Cfg: setting.NewCfg(),
|
||||
log: log.New(),
|
||||
pluginClient: &fakePluginClient{},
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
|
||||
@ -403,8 +399,6 @@ func TestMakePluginResourceRequestSetCookieNotPresent(t *testing.T) {
|
||||
pluginClient: &fakePluginClient{
|
||||
headers: map[string][]string{"Set-Cookie": {"monster"}},
|
||||
},
|
||||
cachingService: &caching.OSSCachingService{},
|
||||
Features: &featuremgmt.FeatureManager{},
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
resp := httptest.NewRecorder()
|
||||
@ -439,8 +433,6 @@ func TestMakePluginResourceRequestContentTypeUnique(t *testing.T) {
|
||||
"x-another": {"hello"},
|
||||
},
|
||||
},
|
||||
cachingService: &caching.OSSCachingService{},
|
||||
Features: &featuremgmt.FeatureManager{},
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
resp := httptest.NewRecorder()
|
||||
@ -464,11 +456,9 @@ func TestMakePluginResourceRequestContentTypeEmpty(t *testing.T) {
|
||||
statusCode: http.StatusNoContent,
|
||||
}
|
||||
hs := HTTPServer{
|
||||
Cfg: setting.NewCfg(),
|
||||
log: log.New(),
|
||||
pluginClient: pluginClient,
|
||||
cachingService: &caching.OSSCachingService{},
|
||||
Features: &featuremgmt.FeatureManager{},
|
||||
Cfg: setting.NewCfg(),
|
||||
log: log.New(),
|
||||
pluginClient: pluginClient,
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
resp := httptest.NewRecorder()
|
||||
|
Reference in New Issue
Block a user