diff --git a/pkg/tests/apis/provisioning/files_test.go b/pkg/tests/apis/provisioning/files_test.go index a6913b4291a..823241aa6b0 100644 --- a/pkg/tests/apis/provisioning/files_test.go +++ b/pkg/tests/apis/provisioning/files_test.go @@ -68,23 +68,13 @@ func TestIntegrationProvisioning_DeleteResources(t *testing.T) { helper.validateManagedDashboardsFolderMetadata(t, ctx, repo, dashboards.Items) -<<<<<<< HEAD - t.Run("delete individual dashboard file on configured branch should return MethodNotAllowed", func(t *testing.T) { -======= t.Run("delete individual dashboard file on configured branch should succeed", func(t *testing.T) { ->>>>>>> origin/main result := helper.AdminREST.Delete(). Namespace("default"). Resource("repositories"). Name(repo). SubResource("files", "dashboard1.json"). Do(ctx) -<<<<<<< HEAD - require.Error(t, result.Error()) - var statusErr *apierrors.StatusError - require.True(t, errors.As(result.Error(), &statusErr), "error should be a StatusError") - require.Equal(t, int32(http.StatusMethodNotAllowed), statusErr.ErrStatus.Code, "should return MethodNotAllowed for configured branch delete") -======= require.NoError(t, result.Error(), "delete file on configured branch should succeed") // Verify the dashboard is removed from Grafana @@ -92,7 +82,6 @@ func TestIntegrationProvisioning_DeleteResources(t *testing.T) { _, err := helper.DashboardsV1.Resource.Get(ctx, allPanelsUID, metav1.GetOptions{}) require.Error(t, err, "dashboard should be deleted from Grafana") require.True(t, apierrors.IsNotFound(err), "should return NotFound for deleted dashboard") ->>>>>>> origin/main }) t.Run("delete individual dashboard file on branch should succeed", func(t *testing.T) { @@ -176,11 +165,7 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { require.NoError(t, err, "original dashboard should exist in Grafana") require.Equal(t, repo, obj.GetAnnotations()[utils.AnnoKeyManagerIdentity]) -<<<<<<< HEAD - t.Run("move file without content change on configured branch should return MethodNotAllowed", func(t *testing.T) { -======= t.Run("move file without content change on configured branch should succeed", func(t *testing.T) { ->>>>>>> origin/main const targetPath = "moved/simple-move.json" // Perform the move operation using helper function (no ref = configured branch) @@ -191,9 +176,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { }) // nolint:errcheck defer resp.Body.Close() -<<<<<<< HEAD - require.Equal(t, http.StatusMethodNotAllowed, resp.StatusCode, "move operation on configured branch should return MethodNotAllowed") -======= require.Equal(t, http.StatusOK, resp.StatusCode, "move operation on configured branch should succeed") // Verify file was moved - read from new location @@ -203,7 +185,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { // Verify file no longer exists at old location _, err = helper.Repositories.Resource.Get(ctx, repo, metav1.GetOptions{}, "files", "all-panels.json") require.Error(t, err, "file should not exist at old location") ->>>>>>> origin/main }) t.Run("move file without content change on branch should succeed", func(t *testing.T) { @@ -240,11 +221,7 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { } }) -<<<<<<< HEAD - t.Run("move file to nested path on configured branch should return MethodNotAllowed", func(t *testing.T) { -======= t.Run("move file to nested path on configured branch should succeed", func(t *testing.T) { ->>>>>>> origin/main // Test a different scenario: Move a file that was never synced to Grafana // This might reveal the issue if dashboard creation fails during move const sourceFile = "never-synced.json" @@ -261,17 +238,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { }) // nolint:errcheck defer resp.Body.Close() -<<<<<<< HEAD - require.Equal(t, http.StatusMethodNotAllowed, resp.StatusCode, "move operation on configured branch should return MethodNotAllowed") - - // File should still exist at original location since move was rejected - _, err := helper.Repositories.Resource.Get(ctx, repo, metav1.GetOptions{}, "files", sourceFile) - require.NoError(t, err, "original file should still exist after rejected move") - }) - - t.Run("move file with content update on configured branch should return MethodNotAllowed", func(t *testing.T) { - const sourcePath = "all-panels.json" -======= require.Equal(t, http.StatusOK, resp.StatusCode, "move operation on configured branch should succeed") // File should exist at new location @@ -285,7 +251,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { t.Run("move file with content update on configured branch should succeed", func(t *testing.T) { const sourcePath = "moved/simple-move.json" // Use the file we moved earlier ->>>>>>> origin/main const targetPath = "updated/content-updated.json" // Use text-options.json content for the update @@ -300,13 +265,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { }) // nolint:errcheck defer resp.Body.Close() -<<<<<<< HEAD - require.Equal(t, http.StatusMethodNotAllowed, resp.StatusCode, "move with content update on configured branch should return MethodNotAllowed") - - // Source file should still exist since move was rejected - _, err := helper.Repositories.Resource.Get(ctx, repo, metav1.GetOptions{}, "files", sourcePath) - require.NoError(t, err, "source file should still exist after rejected move") -======= require.Equal(t, http.StatusOK, resp.StatusCode, "move with content update on configured branch should succeed") // File should exist at new location with updated content @@ -325,7 +283,6 @@ func TestIntegrationProvisioning_MoveResources(t *testing.T) { // Source file should not exist anymore _, err = helper.Repositories.Resource.Get(ctx, repo, metav1.GetOptions{}, "files", sourcePath) require.Error(t, err, "source file should not exist after move") ->>>>>>> origin/main }) t.Run("move directory on configured branch should return MethodNotAllowed", func(t *testing.T) {