NestedFolders: Fix nested folder deletion (#63572)

---------

Co-authored-by: suntala <arati.rana@grafana.com>
Co-authored-by: ying-jeanne <ying-jeanne@users.noreply.github.com>
Co-authored-by: jeanne0731 <jeanne0731@users.noreply.github.com>
This commit is contained in:
ying-jeanne
2023-03-15 09:51:37 +01:00
committed by GitHub
co-authored by suntala ying-jeanne jeanne0731
parent ec003d502b
commit 6974f4340b
3 changed files with 216 additions and 97 deletions
@@ -153,7 +153,7 @@ func TestIntegrationDelete(t *testing.T) {
})
*/
ancestorUIDs := CreateSubTree(t, folderStore, orgID, "", folder.MaxNestedFolderDepth, "")
ancestorUIDs := CreateSubtree(t, folderStore, orgID, "", folder.MaxNestedFolderDepth, "")
require.Len(t, ancestorUIDs, folder.MaxNestedFolderDepth)
t.Cleanup(func() {
@@ -603,8 +603,7 @@ func TestIntegrationGetHeight(t *testing.T) {
UID: uid1,
})
require.NoError(t, err)
subTree := CreateSubTree(t, folderStore, orgID, parent.UID, 4, "sub")
subTree := CreateSubtree(t, folderStore, orgID, parent.UID, 4, "sub")
t.Run("should successfully get height", func(t *testing.T) {
height, err := folderStore.GetHeight(context.Background(), parent.UID, orgID, nil)
require.NoError(t, err)
@@ -632,7 +631,7 @@ func CreateOrg(t *testing.T, db *sqlstore.SQLStore) int64 {
return orgID
}
func CreateSubTree(t *testing.T, store *sqlStore, orgID int64, parentUID string, depth int, prefix string) []string {
func CreateSubtree(t *testing.T, store *sqlStore, orgID int64, parentUID string, depth int, prefix string) []string {
t.Helper()
ancestorUIDs := []string{}