unified-storage: Reduce calls to the user service (#102934)

* Create ListByIdOrUID in user service

* create UnstructuredToLegacyFolderList 

* update GetFolders to use list parser

* update GetDescendants to use list parser

* update UnstructuredToLegacyFolder to also make a single call to the user service

---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
Will AssisandStephanie Hingtgen authored and GitHub committed 2025-03-27 22:01:07 +02:00
1 parent 7e3efb3df2
commit 51825cfffe
13 files changed
+643 -63

No files matched your search

@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/services/apiserver/client"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/user/usertest"
"github.com/grafana/grafana/pkg/storage/unified/resource"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
@@ -93,7 +94,8 @@ func TestComputeFullPath(t *testing.T) {
func TestGetParents(t *testing.T) {
mockCli := new(client.MockK8sHandler)
store := FolderUnifiedStoreImpl{
k8sclient: mockCli,
k8sclient: mockCli,
userService: usertest.NewUserServiceFake(),
}
ctx := context.Background()
@@ -187,7 +189,8 @@ func TestGetParents(t *testing.T) {
func TestGetChildren(t *testing.T) {
mockCli := new(client.MockK8sHandler)
store := FolderUnifiedStoreImpl{
k8sclient: mockCli,
k8sclient: mockCli,
userService: usertest.NewUserServiceFake(),
}
ctx := context.Background()