summaryrefslogtreecommitdiffstats
path: root/tests/integration/pull_update_test.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-07-19 02:14:47 +0800
committerGitHub <noreply@github.com>2023-07-18 18:14:47 +0000
commit236c645bf16754ca9294545e71014a01a24ccfd8 (patch)
tree4ca9d8f93aca854d841a7379955e9653a8212546 /tests/integration/pull_update_test.go
parent265a28802a6062d86964c9bfe1959437eaf69afb (diff)
downloadgitea-236c645bf16754ca9294545e71014a01a24ccfd8.tar.gz
gitea-236c645bf16754ca9294545e71014a01a24ccfd8.zip
Refactor "Content" for file uploading (#25851)
Before: the concept "Content string" is used everywhere. It has some problems: 1. Sometimes it means "base64 encoded content", sometimes it means "raw binary content" 2. It doesn't work with large files, eg: uploading a 1G LFS file would make Gitea process OOM This PR does the refactoring: use "ContentReader" / "ContentBase64" instead of "Content" This PR is not breaking because the key in API JSON is still "content": `` ContentBase64 string `json:"content"` ``
Diffstat (limited to 'tests/integration/pull_update_test.go')
-rw-r--r--tests/integration/pull_update_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/integration/pull_update_test.go b/tests/integration/pull_update_test.go
index fa56cec485..80c55042db 100644
--- a/tests/integration/pull_update_test.go
+++ b/tests/integration/pull_update_test.go
@@ -6,6 +6,7 @@ package integration
import (
"net/http"
"net/url"
+ "strings"
"testing"
"time"
@@ -104,9 +105,9 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
_, err = files_service.ChangeRepoFiles(git.DefaultContext, baseRepo, actor, &files_service.ChangeRepoFilesOptions{
Files: []*files_service.ChangeRepoFile{
{
- Operation: "create",
- TreePath: "File_A",
- Content: "File A",
+ Operation: "create",
+ TreePath: "File_A",
+ ContentReader: strings.NewReader("File A"),
},
},
Message: "Add File A",
@@ -131,9 +132,9 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
_, err = files_service.ChangeRepoFiles(git.DefaultContext, headRepo, actor, &files_service.ChangeRepoFilesOptions{
Files: []*files_service.ChangeRepoFile{
{
- Operation: "create",
- TreePath: "File_B",
- Content: "File B",
+ Operation: "create",
+ TreePath: "File_B",
+ ContentReader: strings.NewReader("File B"),
},
},
Message: "Add File on PR branch",