mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
[GITEA] Remove redundant syncBranchToDB
- The transaction in combination with Git push was causing deadlocks if you had the `push_update` queue set to `immediate`. This was the root cause of slow integration tests in CI. - Remove the sync branch code as this is already being done in the Git post-receive hook. - Add tests to proof the branch models are in sync even with this code removed. (cherry picked from commit90110e1f44
) (cherry picked from commita064065cb9
)
This commit is contained in:
parent
30bd28eed3
commit
7713e558eb
3 changed files with 65 additions and 78 deletions
|
@ -10,6 +10,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
git_model "code.gitea.io/gitea/models/git"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/translation"
|
||||
|
@ -47,12 +49,14 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
|||
CreateRelease string
|
||||
FlashMessage string
|
||||
ExpectedStatus int
|
||||
CheckBranch bool
|
||||
}{
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
NewBranch: "feature/test1",
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test1"),
|
||||
CheckBranch: true,
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
|
@ -65,6 +69,7 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
|||
NewBranch: "feature=test1",
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature=test1"),
|
||||
CheckBranch: true,
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
|
@ -94,6 +99,7 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
|||
NewBranch: "feature/test3",
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test3"),
|
||||
CheckBranch: true,
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
|
@ -108,10 +114,15 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
|||
CreateRelease: "v1.0.1",
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").Tr("repo.branch.create_success", "feature/test4"),
|
||||
CheckBranch: true,
|
||||
},
|
||||
}
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
for _, test := range tests {
|
||||
session := loginUser(t, "user2")
|
||||
if test.CheckBranch {
|
||||
unittest.AssertNotExistsBean(t, &git_model.Branch{RepoID: 1, Name: test.NewBranch})
|
||||
}
|
||||
if test.CreateRelease != "" {
|
||||
createNewRelease(t, session, "/user2/repo1", test.CreateRelease, test.CreateRelease, false, false)
|
||||
}
|
||||
|
@ -125,6 +136,9 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
|||
test.FlashMessage,
|
||||
)
|
||||
}
|
||||
if test.CheckBranch {
|
||||
unittest.AssertExistsAndLoadBean(t, &git_model.Branch{RepoID: 1, Name: test.NewBranch})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue