Skip to content

Commit ef9e9f1

Browse files
committed
Fix wrong code
1 parent 85eada2 commit ef9e9f1

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

tests/integration/pull_status_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -165,77 +165,3 @@ func TestPullCreate_EmptyChangesWithSameCommits(t *testing.T) {
165165
assert.Contains(t, text, "This branch is already included in the target branch. There is nothing to merge.")
166166
})
167167
}
168-
<<<<<<< HEAD
169-
=======
170-
171-
func TestPullStatusDelayCheck(t *testing.T) {
172-
onGiteaRun(t, func(t *testing.T, u *url.URL) {
173-
defer test.MockVariableValue(&setting.Repository.PullRequest.DelayCheckForInactiveDays, 1)()
174-
defer test.MockVariableValue(&pull.AddPullRequestToCheckQueue)()
175-
176-
session := loginUser(t, "user2")
177-
178-
run := func(t *testing.T, fn func(*testing.T)) (issue3 *issues.Issue, checkedPrID int64) {
179-
pull.AddPullRequestToCheckQueue = func(prID int64) {
180-
checkedPrID = prID
181-
}
182-
fn(t)
183-
issue3 = unittest.AssertExistsAndLoadBean(t, &issues.Issue{RepoID: 1, Index: 3})
184-
_ = issue3.LoadPullRequest(t.Context())
185-
return issue3, checkedPrID
186-
}
187-
188-
assertReloadingInterval := func(t *testing.T, interval string) {
189-
req := NewRequest(t, "GET", "/user2/repo1/pulls/3")
190-
resp := session.MakeRequest(t, req, http.StatusOK)
191-
attr := "data-pull-merge-box-reloading-interval"
192-
if interval == "" {
193-
assert.NotContains(t, resp.Body.String(), attr)
194-
} else {
195-
assert.Contains(t, resp.Body.String(), fmt.Sprintf(`%s="%v"`, attr, interval))
196-
}
197-
}
198-
199-
// PR issue3 is merageable at the beginning
200-
issue3, checkedPrID := run(t, func(t *testing.T) {})
201-
assert.Equal(t, issues.PullRequestStatusMergeable, issue3.PullRequest.Status)
202-
assert.Zero(t, checkedPrID)
203-
assertReloadingInterval(t, "") // the PR is mergeable, so no need to reload the merge box
204-
205-
// setting.IsProd = false // it would cause data-race because the queue handlers might be running and reading its value
206-
// assertReloadingInterval(t, "1") // make sure dev mode always do merge box reloading, to make sure the UI logic won't break
207-
// setting.IsProd = true
208-
209-
// when base branch changes, PR status should be updated, but it is inactive for long time, so no real check
210-
issue3, checkedPrID = run(t, func(t *testing.T) {
211-
testEditFile(t, session, "user2", "repo1", "master", "README.md", "new content 1")
212-
})
213-
assert.Equal(t, issues.PullRequestStatusChecking, issue3.PullRequest.Status)
214-
assert.Zero(t, checkedPrID)
215-
assertReloadingInterval(t, "2000") // the PR status is "checking", so try to reload the merge box
216-
217-
// view a PR with status=checking, it starts the real check
218-
issue3, checkedPrID = run(t, func(t *testing.T) {
219-
req := NewRequest(t, "GET", "/user2/repo1/pulls/3")
220-
session.MakeRequest(t, req, http.StatusOK)
221-
})
222-
assert.Equal(t, issues.PullRequestStatusChecking, issue3.PullRequest.Status)
223-
assert.Equal(t, issue3.PullRequest.ID, checkedPrID)
224-
225-
// when base branch changes, still so no real check
226-
issue3, checkedPrID = run(t, func(t *testing.T) {
227-
testEditFile(t, session, "user2", "repo1", "master", "README.md", "new content 2")
228-
})
229-
assert.Equal(t, issues.PullRequestStatusChecking, issue3.PullRequest.Status)
230-
assert.Zero(t, checkedPrID)
231-
232-
// then allow to check PRs without delay, when base branch changes, the PRs will be checked
233-
setting.Repository.PullRequest.DelayCheckForInactiveDays = -1
234-
issue3, checkedPrID = run(t, func(t *testing.T) {
235-
testEditFile(t, session, "user2", "repo1", "master", "README.md", "new content 3")
236-
})
237-
assert.Equal(t, issues.PullRequestStatusChecking, issue3.PullRequest.Status)
238-
assert.Equal(t, issue3.PullRequest.ID, checkedPrID)
239-
})
240-
}
241-
>>>>>>> 44ece1e6f3 (Explicitly not update indexes when sync database schemas (#34281))

0 commit comments

Comments
 (0)