From 53537148e1bd3113cb3bd2c7e710430d5c1b634f Mon Sep 17 00:00:00 2001 From: maicon Date: Tue, 8 Jul 2025 11:26:45 -0300 Subject: [PATCH] Folders: reenable unit tests (#107751) * Folders: reenable unit test TestFoldersCreateAPIEndpointK8S Signed-off-by: Maicon Costa * reenable unit test TestFoldersGetAPIEndpointK8S Signed-off-by: Maicon Costa --------- Signed-off-by: Maicon Costa --- pkg/tests/apis/folder/folders_test.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/tests/apis/folder/folders_test.go b/pkg/tests/apis/folder/folders_test.go index 35722cbc964..7bd8fda8e61 100644 --- a/pkg/tests/apis/folder/folders_test.go +++ b/pkg/tests/apis/folder/folders_test.go @@ -862,10 +862,6 @@ func TestIntegrationFolderGetPermissions(t *testing.T) { // TestFoldersCreateAPIEndpointK8S is the counterpart of pkg/api/folder_test.go TestFoldersCreateAPIEndpoint func TestFoldersCreateAPIEndpointK8S(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - folderWithoutParentInput := "{ \"uid\": \"uid\", \"title\": \"Folder\"}" folderWithTitleEmpty := "{ \"title\": \"\"}" folderWithInvalidUid := "{ \"uid\": \"::::::::::::\", \"title\": \"Another folder\"}" @@ -902,7 +898,7 @@ func TestFoldersCreateAPIEndpointK8S(t *testing.T) { description: "folder creation fails without permissions to create a folder", input: folderWithoutParentInput, expectedCode: http.StatusForbidden, - expectedMessage: dashboards.ErrFolderAccessDenied.Error(), + expectedMessage: fmt.Sprintf("You'll need additional permissions to perform this action. Permissions needed: %s", "folders:create"), permissions: []resourcepermissions.SetResourcePermissionCommand{}, }, { @@ -1023,10 +1019,6 @@ func testDescription(description string, expectedErr error) string { // There are no counterpart of TestFoldersGetAPIEndpointK8S in pkg/api/folder_test.go func TestFoldersGetAPIEndpointK8S(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - type testCase struct { description string expectedCode int @@ -1062,6 +1054,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) { expectedOutput: []dtos.FolderSearchHit{ {UID: "foo", Title: "Folder 1"}, {UID: "qux", Title: "Folder 3"}, + {UID: folder.SharedWithMeFolder.UID, Title: folder.SharedWithMeFolder.Title}, }, permissions: folderReadAndCreatePermission, }, @@ -1107,7 +1100,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) { } // test on all dualwriter modes - for mode := 1; mode <= 4; mode++ { + for mode := 0; mode <= 4; mode++ { for _, tc := range tcs { t.Run(fmt.Sprintf("Mode: %d, %s", mode, tc.description), func(t *testing.T) { modeDw := grafanarest.DualWriterMode(mode) @@ -1123,6 +1116,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) { }, EnableFeatureToggles: []string{ featuremgmt.FlagNestedFolders, + featuremgmt.FlagUnifiedStorageSearch, featuremgmt.FlagKubernetesClientDashboardsFolders, }, })