Dashboards: Add feature restore dashboards backend (#83131)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Ezequiel Victorero
2024-05-16 14:36:26 -03:00
committed by GitHub
parent edae5fc791
commit 42d75ac737
30 changed files with 1230 additions and 96 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/infra/appcontext"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/folder/foldertest"
"github.com/grafana/grafana/pkg/services/guardian"
@@ -30,6 +31,7 @@ func TestDashboardService(t *testing.T) {
log: log.New("test.logger"),
dashboardStore: &fakeStore,
folderService: folderSvc,
features: featuremgmt.WithFeatures(),
}
origNewDashboardGuardian := guardian.New
@@ -212,5 +214,12 @@ func TestDashboardService(t *testing.T) {
err := service.DeleteInFolders(context.Background(), 1, []string{"uid"}, nil)
require.NoError(t, err)
})
t.Run("Soft Delete dashboards in folder", func(t *testing.T) {
service.features = featuremgmt.WithFeatures(featuremgmt.FlagDashboardRestore)
fakeStore.On("SoftDeleteDashboardsInFolders", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
err := service.DeleteInFolders(context.Background(), 1, []string{"uid"}, nil)
require.NoError(t, err)
})
})
}