diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-08-11 22:31:18 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-08-11 23:31:18 +0300 |
commit | e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6 (patch) | |
tree | a4940d4ff3c8c16015a13be3c8540ec63565890b /integrations | |
parent | 8bfeb85f93ccd41289f901977243258e1b69f4d6 (diff) | |
download | gitea-e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6.tar.gz gitea-e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6.zip |
Fix duplicate call of webhook (#7821)
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/pull_merge_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go index f3efa63b07..2f4e48f293 100644 --- a/integrations/pull_merge_test.go +++ b/integrations/pull_merge_test.go @@ -54,6 +54,10 @@ func testPullCleanUp(t *testing.T, session *TestSession, user, repo, pullnum str func TestPullMerge(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { + hookTasks, err := models.HookTasks(1, 1) //Retrieve previous hook number + assert.NoError(t, err) + hookTasksLenBefore := len(hookTasks) + session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n") @@ -63,11 +67,19 @@ func TestPullMerge(t *testing.T) { elem := strings.Split(test.RedirectURL(resp), "/") assert.EqualValues(t, "pulls", elem[3]) testPullMerge(t, session, elem[1], elem[2], elem[4], models.MergeStyleMerge) + + hookTasks, err = models.HookTasks(1, 1) + assert.NoError(t, err) + assert.Len(t, hookTasks, hookTasksLenBefore+1) }) } func TestPullRebase(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { + hookTasks, err := models.HookTasks(1, 1) //Retrieve previous hook number + assert.NoError(t, err) + hookTasksLenBefore := len(hookTasks) + session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n") @@ -77,12 +89,21 @@ func TestPullRebase(t *testing.T) { elem := strings.Split(test.RedirectURL(resp), "/") assert.EqualValues(t, "pulls", elem[3]) testPullMerge(t, session, elem[1], elem[2], elem[4], models.MergeStyleRebase) + + hookTasks, err = models.HookTasks(1, 1) + assert.NoError(t, err) + assert.Len(t, hookTasks, hookTasksLenBefore+1) }) } func TestPullRebaseMerge(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { prepareTestEnv(t) + + hookTasks, err := models.HookTasks(1, 1) //Retrieve previous hook number + assert.NoError(t, err) + hookTasksLenBefore := len(hookTasks) + session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n") @@ -92,12 +113,21 @@ func TestPullRebaseMerge(t *testing.T) { elem := strings.Split(test.RedirectURL(resp), "/") assert.EqualValues(t, "pulls", elem[3]) testPullMerge(t, session, elem[1], elem[2], elem[4], models.MergeStyleRebaseMerge) + + hookTasks, err = models.HookTasks(1, 1) + assert.NoError(t, err) + assert.Len(t, hookTasks, hookTasksLenBefore+1) }) } func TestPullSquash(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { prepareTestEnv(t) + + hookTasks, err := models.HookTasks(1, 1) //Retrieve previous hook number + assert.NoError(t, err) + hookTasksLenBefore := len(hookTasks) + session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n") @@ -108,6 +138,10 @@ func TestPullSquash(t *testing.T) { elem := strings.Split(test.RedirectURL(resp), "/") assert.EqualValues(t, "pulls", elem[3]) testPullMerge(t, session, elem[1], elem[2], elem[4], models.MergeStyleSquash) + + hookTasks, err = models.HookTasks(1, 1) + assert.NoError(t, err) + assert.Len(t, hookTasks, hookTasksLenBefore+1) }) } |