[BUG] transient error FAIL: TestAPITeam 404 Not Found #111

Closed
opened 2022-12-14 21:41:33 +00:00 by dachary · 8 comments

Upstream reference

Description

--- FAIL: TestAPITeam (2.43s)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-5] router: completed GET /user/settings/applications for , 200 OK in 11.3ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-6] router: completed POST /user/settings/applications for , 303 See Other in 123.6ms @ setting/applications.go:33(setting.ApplicationsPost)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-7] router: completed GET /user/settings/applications for , 200 OK in 12.5ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-8] router: completed GET /api/v1/teams/3?token=29f780bc4cee7bb2f5726756baa45111af818865 for , 200 OK in 131.6ms @ org/team.go:111(org.GetTeam)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-9] router: completed GET /user/settings/applications for , 200 OK in 14.4ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-10] router: completed POST /user/settings/applications for , 303 See Other in 138.3ms @ setting/applications.go:33(setting.ApplicationsPost)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-11] router: completed GET /user/settings/applications for , 200 OK in 18.4ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-12] router: completed GET /api/v1/teams/3?token=f7565957260ca1067fa53eb9c32ad279ecb0b837 for , 404 Not Found in 123.7ms @ v1/api.go:350(v1.reqTeamMembership)
    api_team_test.go:48: 
        	Error Trace:	/go/src/codeberg/gitea/integration_test.go:336
        	            				/go/src/codeberg/gitea/api_team_test.go:48
        	Error:      	Not equal: 
        	            	expected: 403
        	            	actual  : 404
        	Test:       	TestAPITeam
        	Messages:   	Request: GET /api/v1/teams/3?token=f7565957260ca1067fa53eb9c32ad279ecb0b837
    api_team_test.go:48: Response: {"errors":null,"message":"The target couldn't be found.","url":"http://localhost:3002/api/swagger"}
        
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-13] router: completed GET /api/v1/teams/3 for , 401 Unauthorized in 0.6ms @ v1/api.go:211(v1.reqToken)
    testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-14] router: completed GET /user/settings/applications for , 200 OK in 15.4ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57] router: completed POST /user/settings/applications for , 303 See Other in 122.1ms @ setting/applications.go:33(setting.ApplicationsPost)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-2] router: completed GET /user/settings/applications for , 200 OK in 14.7ms @ setting/applications.go:23(setting.Applications)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-3] router: completed POST /api/v1/orgs/user6/teams?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 201 Created in 128.6ms @ org/team.go:169(org.CreateTeam)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-4] router: completed PATCH /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 131.0ms @ org/team.go:235(org.EditTeam)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-5] router: completed PATCH /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 128.6ms @ org/team.go:235(org.EditTeam)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-6] router: completed GET /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 129.8ms @ org/team.go:111(org.GetTeam)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-7] router: completed DELETE /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 204 No Content in 146.0ms @ org/team.go:318(org.DeleteTeam)
    testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-8] router: completed POST /api/v1/orgs/user6/teams?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 201 Created in 143.6ms @ org/team.go:169(org.CreateTeam)
    testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e57-9] router: completed PATCH /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 131.0ms @ org/team.go:235(org.EditTeam)
    testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58] router: completed PATCH /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 146.1ms @ org/team.go:235(org.EditTeam)
    testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58-2] router: completed GET /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 122.4ms @ org/team.go:111(org.GetTeam)
    testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58-3] router: completed DELETE /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 204 No Content in 142.8ms @ org/team.go:318(org.DeleteTeam)
### Upstream reference * https://github.com/go-gitea/gitea/pull/22192 ### Description * https://forgejo-woodpecker.gna.org/forgejo/forgejo/pipeline/9/18 * https://forgejo-ci.codeberg.org/forgejo/forgejo/pipeline/35/21 ``` --- FAIL: TestAPITeam (2.43s) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-5] router: completed GET /user/settings/applications for , 200 OK in 11.3ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-6] router: completed POST /user/settings/applications for , 303 See Other in 123.6ms @ setting/applications.go:33(setting.ApplicationsPost) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-7] router: completed GET /user/settings/applications for , 200 OK in 12.5ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-8] router: completed GET /api/v1/teams/3?token=29f780bc4cee7bb2f5726756baa45111af818865 for , 200 OK in 131.6ms @ org/team.go:111(org.GetTeam) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-9] router: completed GET /user/settings/applications for , 200 OK in 14.4ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-10] router: completed POST /user/settings/applications for , 303 See Other in 138.3ms @ setting/applications.go:33(setting.ApplicationsPost) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-11] router: completed GET /user/settings/applications for , 200 OK in 18.4ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-12] router: completed GET /api/v1/teams/3?token=f7565957260ca1067fa53eb9c32ad279ecb0b837 for , 404 Not Found in 123.7ms @ v1/api.go:350(v1.reqTeamMembership) api_team_test.go:48: Error Trace: /go/src/codeberg/gitea/integration_test.go:336 /go/src/codeberg/gitea/api_team_test.go:48 Error: Not equal: expected: 403 actual : 404 Test: TestAPITeam Messages: Request: GET /api/v1/teams/3?token=f7565957260ca1067fa53eb9c32ad279ecb0b837 api_team_test.go:48: Response: {"errors":null,"message":"The target couldn't be found.","url":"http://localhost:3002/api/swagger"} testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-13] router: completed GET /api/v1/teams/3 for , 401 Unauthorized in 0.6ms @ v1/api.go:211(v1.reqToken) testlogger.go:77: 2022/12/14 21:21:26 ...eb/routing/logger.go:98:func1() [I] [639a3e56-14] router: completed GET /user/settings/applications for , 200 OK in 15.4ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57] router: completed POST /user/settings/applications for , 303 See Other in 122.1ms @ setting/applications.go:33(setting.ApplicationsPost) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-2] router: completed GET /user/settings/applications for , 200 OK in 14.7ms @ setting/applications.go:23(setting.Applications) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-3] router: completed POST /api/v1/orgs/user6/teams?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 201 Created in 128.6ms @ org/team.go:169(org.CreateTeam) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-4] router: completed PATCH /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 131.0ms @ org/team.go:235(org.EditTeam) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-5] router: completed PATCH /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 128.6ms @ org/team.go:235(org.EditTeam) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-6] router: completed GET /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 129.8ms @ org/team.go:111(org.GetTeam) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-7] router: completed DELETE /api/v1/teams/14?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 204 No Content in 146.0ms @ org/team.go:318(org.DeleteTeam) testlogger.go:77: 2022/12/14 21:21:27 ...eb/routing/logger.go:98:func1() [I] [639a3e57-8] router: completed POST /api/v1/orgs/user6/teams?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 201 Created in 143.6ms @ org/team.go:169(org.CreateTeam) testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e57-9] router: completed PATCH /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 131.0ms @ org/team.go:235(org.EditTeam) testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58] router: completed PATCH /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 146.1ms @ org/team.go:235(org.EditTeam) testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58-2] router: completed GET /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 200 OK in 122.4ms @ org/team.go:111(org.GetTeam) testlogger.go:77: 2022/12/14 21:21:28 ...eb/routing/logger.go:98:func1() [I] [639a3e58-3] router: completed DELETE /api/v1/teams/15?token=da7a98a0f992076921d94f70275f9cd017134e7e for , 204 No Content in 142.8ms @ org/team.go:318(org.DeleteTeam) ```
dachary added the
bug
forgejo/ci
labels 2022-12-14 21:41:34 +00:00
Poster
Owner
Another instance today at https://forgejo-ci.codeberg.org/forgejo/forgejo/pipeline/35/21

Might be fixed by this patch:

diff --git a/tests/integration/api_team_test.go b/tests/integration/api_team_test.go
index 46207203b..f54c286fc 100644
--- a/tests/integration/api_team_test.go
+++ b/tests/integration/api_team_test.go
@@ -24,7 +24,7 @@ import (
 func TestAPITeam(t *testing.T) {
        defer tests.PrepareTestEnv(t)()
 
-       teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{})
+       teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1})
        team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID})
        user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID})

I suspect because if it doesn't specify any paramaters it could happen that another TeamUser is given back, which might not be the TeamUser the code is expecting. I will open a PR at Gitea to change this.

Might be fixed by this patch: ```diff diff --git a/tests/integration/api_team_test.go b/tests/integration/api_team_test.go index 46207203b..f54c286fc 100644 --- a/tests/integration/api_team_test.go +++ b/tests/integration/api_team_test.go @@ -24,7 +24,7 @@ import ( func TestAPITeam(t *testing.T) { defer tests.PrepareTestEnv(t)() - teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{}) + teamUser := unittest.AssertExistsAndLoadBean(t, &organization.TeamUser{ID: 1}) team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamUser.TeamID}) user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: teamUser.UID}) ``` I suspect because if it doesn't specify any paramaters it could happen that another TeamUser is given back, which might not be the TeamUser the code is expecting. I will open a PR at Gitea to change this.
https://github.com/go-gitea/gitea/pull/22192
dachary changed title from [CI] transient error FAIL: TestAPITeam 404 Not Found to [BUG] transient error FAIL: TestAPITeam 404 Not Found 2022-12-21 00:36:22 +00:00
dachary added the
issue
open
label 2022-12-21 00:36:26 +00:00
Gusted was assigned by dachary 2022-12-21 00:37:02 +00:00

And... the fix was merged into go-gitea:main on upstream 90572c5a22 .

Thanks to @Gusted and the Gitea team for acting quickly on this.

BTW shortly after another fix was merged, which relates to testing as well Attempt to fix TestExportUserGPGKeys (#22159)

And... the fix was merged into go-gitea:main on upstream https://github.com/go-gitea/gitea/commit/90572c5a22ab753e8e019d276426df7b1bf6d5b2 . Thanks to @Gusted and the Gitea team for acting quickly on this. BTW shortly after another fix was merged, which relates to testing as well [Attempt to fix TestExportUserGPGKeys (\#22159) ](https://github.com/go-gitea/gitea/commit/fe6608f72bc2c71e30665126b7257650987d8c73)
Poster
Owner

Interestingly this other transient failure never showed on Forgejo. 🤷

Interestingly this other transient failure never showed on Forgejo. 🤷

It was just a sidenote as I've seen it in the commit history when picking up the link to the fix we need, and thought "it hasn't bitten us yet, but there is a reason they fix it, so we could potentially also downstream that one while we are at it and avoid the next transient failure before it hits us.."

It was just a sidenote as I've seen it in the commit history when picking up the link to the fix we need, and thought "it hasn't bitten us yet, but there is a reason they fix it, so we could potentially also downstream that one while we are at it and avoid the next transient failure before it hits us.."

Both commits should be downstreamed on the next rebase of Gitea.

Both commits should be downstreamed on the next rebase of Gitea.
Poster
Owner
It is [set to happen this saturday](https://codeberg.org/forgejo/forgejo/issues/51).
dachary added
issue
closed
and removed
issue
open
labels 2022-12-25 09:21:46 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: forgejo/forgejo#111
There is no content yet.