CI: fix test task (#295)
export GO111MODULE="on" move to go1.14 and add sleep Extend Test Fix Panic Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/295 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
ba7916819f
commit
9832db02f1
2 changed files with 13 additions and 4 deletions
|
@ -34,9 +34,10 @@ steps:
|
||||||
|
|
||||||
- name: testing
|
- name: testing
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.13
|
image: golang:1.14
|
||||||
environment:
|
environment:
|
||||||
GOPROXY: https://goproxy.cn,direct
|
GOPROXY: "https://goproxy.cn"
|
||||||
|
GO111MODULE: "on"
|
||||||
HTTP_PROXY: ""
|
HTTP_PROXY: ""
|
||||||
GITEA_SDK_TEST_URL: "http://gitea:3000"
|
GITEA_SDK_TEST_URL: "http://gitea:3000"
|
||||||
GITEA_SDK_TEST_USERNAME: "test01"
|
GITEA_SDK_TEST_USERNAME: "test01"
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -43,6 +44,7 @@ func TestNotifications(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
issue, err := c.CreateIssue(repoB.Owner.UserName, repoB.Name, CreateIssueOption{Title: "B Issue", Closed: false})
|
issue, err := c.CreateIssue(repoB.Owner.UserName, repoB.Name, CreateIssueOption{Title: "B Issue", Closed: false})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
time.Sleep(time.Second * 1)
|
||||||
|
|
||||||
// CheckNotifications of user2
|
// CheckNotifications of user2
|
||||||
c.sudo = user2.UserName
|
c.sudo = user2.UserName
|
||||||
|
@ -93,10 +95,16 @@ func TestNotifications(t *testing.T) {
|
||||||
c.sudo = ""
|
c.sudo = ""
|
||||||
_, err = c.EditIssue(repoB.Owner.UserName, repoB.Name, issue.Index, EditIssueOption{State: &iState})
|
_, err = c.EditIssue(repoB.Owner.UserName, repoB.Name, issue.Index, EditIssueOption{State: &iState})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
time.Sleep(time.Second * 1)
|
||||||
|
|
||||||
c.sudo = user2.UserName
|
c.sudo = user2.UserName
|
||||||
nList, err = c.ListNotifications(ListNotificationOptions{})
|
nList, err = c.ListNotifications(ListNotificationOptions{})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Len(t, nList, 1)
|
count, err = c.CheckNotifications()
|
||||||
err = c.ReadNotification(nList[0].ID)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
assert.EqualValues(t, 1, count)
|
||||||
|
assert.Len(t, nList, 1)
|
||||||
|
if len(nList) > 0 {
|
||||||
|
assert.NoError(t, c.ReadNotification(nList[0].ID))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue