ci: update testing for Forgejo 7.0.4 release (#12)

- bump Forgejo version to test against to 7.0.4
- ci: Increase the number of milestones to be checked in the test from 2 to 3
- ci: improve test stability by increasing sleep by 100ms
- ci: update avatar url in user test and test more user emails

Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/12
Co-authored-by: Martijn van der Kleijn <martijn.niji@gmail.com>
Co-committed-by: Martijn van der Kleijn <martijn.niji@gmail.com>
This commit is contained in:
Martijn van der Kleijn 2024-06-15 21:37:06 +00:00 committed by Martijn van der Kleijn
parent bbaa2f11ad
commit c686623cee
5 changed files with 7 additions and 7 deletions

View file

@ -31,7 +31,7 @@ depends_on:
services:
- name: forgejo
image: codeberg.org/forgejo/forgejo:1.21.5-0
image: codeberg.org/forgejo/forgejo:7.0.4
commands:
- mkdir -p /tmp/conf/
- mkdir -p /tmp/data/

View file

@ -11,7 +11,7 @@ PACKAGE := codeberg.org/mvdkleijn/forgejo-sdk/forgejo
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
FORGEJO_VERSION := 1.21.6-0
FORGEJO_VERSION := 7.0.4
FORGEJO_DL := https://codeberg.org/forgejo/forgejo/releases/download/v$(FORGEJO_VERSION)/forgejo-$(FORGEJO_VERSION)-
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)

View file

@ -47,7 +47,7 @@ func TestMilestones(t *testing.T) {
// ListRepoMilestones
ml, _, err := c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{})
assert.NoError(t, err)
assert.Len(t, ml, 2)
assert.Len(t, ml, 3)
ml, _, err = c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{State: StateClosed})
assert.NoError(t, err)
assert.Len(t, ml, 1)

View file

@ -23,7 +23,7 @@ func TestIssue(t *testing.T) {
createIssue(t, c)
// Little sleep in order to give some time for forgejo to properly store all information on database. Without this sleep, CI is a bit unstable
time.Sleep(100 * time.Millisecond)
time.Sleep(200 * time.Millisecond)
editIssues(t, c)
listIssues(t, c)
deleteIssue(t, c)

View file

@ -25,7 +25,7 @@ func TestMyUser(t *testing.T) {
assert.EqualValues(t, "test01", user.UserName)
assert.EqualValues(t, "test01@forgejo.org", user.Email)
assert.EqualValues(t, "", user.FullName)
assert.EqualValues(t, "https://secure.gravatar.com/avatar/90e9f0102fc2832d69ae59a1214601c0?d=identicon", user.AvatarURL)
assert.EqualValues(t, "http://localhost:3000/avatars/90e9f0102fc2832d69ae59a1214601c0", user.AvatarURL)
assert.True(t, user.IsAdmin)
}
@ -149,14 +149,14 @@ func TestUserEmail(t *testing.T) {
el, _, err := c.ListEmails(ListEmailsOptions{})
assert.NoError(t, err)
assert.Len(t, el, 1)
assert.EqualValues(t, "testuseremail@forgejo.org", el[0].Email)
assert.EqualValues(t, "TestUserEmail@forgejo.org", el[0].Email)
assert.True(t, el[0].Primary)
// AddEmail
mails := []string{"wow@mail.send", "speed@mail.me"}
el, _, err = c.AddEmail(CreateEmailOption{Emails: mails})
assert.NoError(t, err)
assert.Len(t, el, 2)
assert.Len(t, el, 3)
_, _, err = c.AddEmail(CreateEmailOption{Emails: []string{mails[1]}})
assert.Error(t, err)
el, _, err = c.ListEmails(ListEmailsOptions{})