mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-20 16:10:50 +00:00
chore: improve slow tests
- Optimize generting random files. - Reduce big file of 128MiB to 32MiB (git was never made for large files anyways, but simply tests that it works). - Reduce looped git operations from 100 iterations to 10. - Add extra print statements to know what a slow test is doing, this also helps to see if a particular piece of code in a slow test is the culprit or if the test is just very extensive. - Set `[ui.notification].EVENT_SOURCE_UPDATE_TIME` to 1s to speed up `TestEventSourceManagerRun`. - Sneaked in some general test improvements.
This commit is contained in:
parent
9e95f80d94
commit
75a8b83946
13 changed files with 94 additions and 113 deletions
|
@ -822,6 +822,7 @@ func TestPullMergeBranchProtect(t *testing.T) {
|
|||
}
|
||||
for _, withAPIOrWeb := range []string{"api", "web"} {
|
||||
t.Run(testCase.name+" "+withAPIOrWeb, func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
branch := testCase.name + "-" + withAPIOrWeb
|
||||
unprotected := branch + "-unprotected"
|
||||
doGitCheckoutBranch(dstPath, "master")(t)
|
||||
|
@ -834,8 +835,7 @@ func TestPullMergeBranchProtect(t *testing.T) {
|
|||
ctx = NewAPITestContext(t, testCase.doer, "not used", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
ctx.Username = owner
|
||||
ctx.Reponame = repo
|
||||
_, err := generateCommitWithNewData(littleSize, dstPath, "user2@example.com", "User Two", testCase.filename)
|
||||
require.NoError(t, err)
|
||||
generateCommitWithNewData(t, littleSize, dstPath, "user2@example.com", "User Two", testCase.filename)
|
||||
doGitPushTestRepository(dstPath, "origin", branch+":"+unprotected)(t)
|
||||
pr, err := doAPICreatePullRequest(ctx, owner, repo, branch, unprotected)(t)
|
||||
require.NoError(t, err)
|
||||
|
@ -1015,6 +1015,7 @@ func TestPullAutoMergeAfterCommitStatusSucceed(t *testing.T) {
|
|||
// perform all tests with API and web routes
|
||||
for _, withAPI := range []bool{false, true} {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
protectedBranch := parameterProtectBranch{
|
||||
"enable_push": "true",
|
||||
"enable_status_check": "true",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue