From c686623cee1baa306f9698ea8dc4d833f316e020 Mon Sep 17 00:00:00 2001 From: Martijn van der Kleijn Date: Sat, 15 Jun 2024 21:37:06 +0000 Subject: [PATCH] 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 Co-committed-by: Martijn van der Kleijn --- .woodpecker/integration.yml | 2 +- Makefile | 2 +- forgejo/issue_milestone_test.go | 2 +- forgejo/issue_test.go | 2 +- forgejo/user_test.go | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.woodpecker/integration.yml b/.woodpecker/integration.yml index 0866612..d089900 100644 --- a/.woodpecker/integration.yml +++ b/.woodpecker/integration.yml @@ -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/ diff --git a/Makefile b/Makefile index 5e70515..674f712 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/forgejo/issue_milestone_test.go b/forgejo/issue_milestone_test.go index cb6fe4c..bf18241 100644 --- a/forgejo/issue_milestone_test.go +++ b/forgejo/issue_milestone_test.go @@ -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) diff --git a/forgejo/issue_test.go b/forgejo/issue_test.go index e66e003..7cb8e93 100644 --- a/forgejo/issue_test.go +++ b/forgejo/issue_test.go @@ -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) diff --git a/forgejo/user_test.go b/forgejo/user_test.go index 3bbb70d..502e706 100644 --- a/forgejo/user_test.go +++ b/forgejo/user_test.go @@ -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{})