Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 6, 2019
1 parent 53a6f62 commit bd483e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions services/pull/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

"code.gitea.io/gitea/models"

"github.com/stretchr/testify/assert"
)

Expand All @@ -20,13 +22,13 @@ func TestPullRequest_AddToTaskQueue(t *testing.T) {
AddToTaskQueue(pr)

select {
case id := <-models.PullRequestQueue.Queue():
case id := <-pullRequestQueue.Queue():
assert.EqualValues(t, strconv.FormatInt(pr.ID, 10), id)
case <-time.After(time.Second):
assert.Fail(t, "Timeout: nothing was added to pullRequestQueue")
}

assert.True(t, models.PullRequestQueue.Exist(pr.ID))
pr = AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
assert.True(t, pullRequestQueue.Exist(pr.ID))
pr = models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
assert.Equal(t, models.PullRequestStatusChecking, pr.Status)
}

0 comments on commit bd483e6

Please sign in to comment.