Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI random failure: TestExportUserGPGKeys #19961

Closed
wxiaoguang opened this issue Jun 13, 2022 · 8 comments
Closed

CI random failure: TestExportUserGPGKeys #19961

wxiaoguang opened this issue Jun 13, 2022 · 8 comments
Labels
issue/duplicate The issue has already been reported. type/testing

Comments

@wxiaoguang
Copy link
Contributor

https://drone.gitea.io/go-gitea/gitea/56043/3/8

--- FAIL: TestExportUserGPGKeys (0.65s)
    user_test.go:222: Testing username user1 export gpg keys
    testlogger.go:78: 2022/06/13 11:01:27 ...eb/routing/logger.go:99:func1() [I] [62a71907-28] router: completed GET /user1.gpg for , 200 OK in 11.2ms @ user/home.go:768(user.ShowGPGKeys)
    testlogger.go:78: 2022/06/13 11:01:27 ...eb/routing/logger.go:99:func1() [I] [62a71907-29] router: completed GET /user/settings/applications for , 200 OK in 27.9ms @ setting/applications.go:25(setting.Applications)
    testlogger.go:78: 2022/06/13 11:01:27 ...eb/routing/logger.go:99:func1() [I] [62a71907-30] router: completed POST /user/settings/applications for , 303 See Other in 17.0ms @ context/auth.go:27(context.Toggle)
    testlogger.go:78: 2022/06/13 11:01:28 ...eb/routing/logger.go:99:func1() [I] [62a71907-31] router: completed GET /user/settings/applications for , 200 OK in 32.1ms @ setting/applications.go:25(setting.Applications)
    testlogger.go:78: 2022/06/13 11:01:28 ...eb/routing/logger.go:99:func1() [I] [62a71908] router: completed POST /api/v1/user/gpg_keys?token= for , 401 Unauthorized in 0.2ms @ v1/api.go:210(v1.reqToken)
    api_gpg_keys_test.go:159: 
        	Error Trace:	integration_test.go:503
        	            				integration_test.go:332
        	            				api_gpg_keys_test.go:159
        	            				user_test.go:155
        	Error:      	Not equal: 
        	            	expected: 201
        	            	actual  : 401
        	Test:       	TestExportUserGPGKeys
        	Messages:   	Request: POST /api/v1/user/gpg_keys?token=
    api_gpg_keys_test.go:159: Response: {"message":"token is required","url":"http://localhost:3002/api/swagger"}
        
    user_test.go:222: Testing username user1 export gpg keys
    testlogger.go:78: 2022/06/13 11:01:28 ...eb/routing/logger.go:99:func1() [I] [62a71908-2] router: completed GET /user1.gpg for , 200 OK in 9.7ms @ user/home.go:768(user.ShowGPGKeys)
    user_test.go:226: 
        	Error Trace:	user_test.go:226
        	            				user_test.go:187
        	Error:      	Not equal: 
        	            	expected: "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBFyy/VUBCADJ7zbM20Z1RWmFoVgp5WkQfI2rU1Vj9cQHes9i42wVLLtcbPeo\nQzubgzvMPITDy7nfWxgSf83E23DoHQ1ACFbQh/6eFSRrjsusp3YQ/08NSfPPbcu8\n0M5G+VGwSfzS5uEcwBVQmHyKdcOZIERTNMtYZx1C3bjLD1XVJHvWz9D72Uq4qeO3\n8SR+lzp5n6ppUakcmRnxt3nGRBj1+hEGkdgzyPo93iy+WioegY2lwCA9xMEo5dah\nBmYxWx51zyiXYlReTaxlyb3/nuSUt8IcW3Q8zjdtJj4Nu8U1SpV8EdaA1I9IPbHW\n510OSLmD3XhqHH5m6mIxL1YoWxk3V7gpDROtABEBAAHNGVVzZXIxIDx1c2VyMUBl\neGFtcGxlLmNvbT7CwI4EEwEIADgWIQTQEbrYxmXsp1z3j7z9+v0I6RSEHwUCXLL9\nVQIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRD9+v0I6RSEH22YCACFqL5+\n6M0m18AMC/pumcpnnmvAS1GrrKTF8nOROA1augZwp1WCNuKw2R6uOJIHANrYECSn\nu7+j6GBP2gbIW8mSAzS6HWCs7GGiPpVtT4wcu8wljUI6BxjpyZtoEkriyBjt6HfK\nrkegbkuySoJvjq4IcO5D1LB1JWgsUjMYQJj/ZpBIzVtjG9QtFSOiT1Hct4PoZHdC\nnsdSgyCkwRZXG+u3kT/wP9F663ba4o16vYlz3dCGo66lF2tyoG3qcyZ1OUzUrnuv\n96ytAzT6XIhrE0nVoBprMxFF5zExotJD3bHjcGBFNLf944bhjKee3U6t9+OsfJVC\nl7N5xxIawCuTQdbfzsBNBFyy/VUBCADe61yGEoTwKfsOKIhxLaNoRmD883O0tiWt\nsoO/HPj9dPQLTOiwXgSgSCd8C+LNxGKct87wgFozpah4tDLC6c0nALuHJ0SLbkfz\n55aRhLeOOcrAydatDp72GroXzqpZ0xZBk5wjIWdgEol2GmVRM8QGbeuakU/HVz5y\nlPzxUUocgdbSi3GE3zbzijQzVJdyL/kw/KP7pKT/PPKKJ2C5NQDLy0XGKEHddXGR\nEWKkVlRalxq/TjfaMR0bi3MpezBsQmp99ATPO/d7trayZUxQHRtXzGFiOXfDHATr\nqN730sODjqvU+mpc/SHCRwh9qWDjZRHSuKU5YDBjb5jIQJivZsQ/ABEBAAHCwHYE\nGAEIACAWIQTQEbrYxmXsp1z3j7z9+v0I6RSEHwUCXLL9VQIbDAAKCRD9+v0I6RSE\nH7WoB/4tXl+97rQ6owPCGSVp1Xbwt2521V7COgsOFRVTRTryEWxRW8mm0S7wQvax\nC0TLXKur6NVYQMn01iyL+FZzRpEWNuYF3f9QeeLJ/+l2DafESNhNTy17+RPmacK6\n21dccpqchByVw/UMDeHSyjQLiG2lxzt8Gfx2gHmSbrq3aWovTGyz6JTffZvfy/n2\n0Hm437OBPazO0gZyXhdV2PE5RSUfvAgm44235tcV5EV0d32TJDfv61+Vr2GUbah6\n7XhJ1v6JYuh8kaYaEz8OpZDeh7f6Ho6PzJrsy/TKTKhGgZNINj1iaPFyOkQgKR5M\nGrE0MHOxUbc9tbtyk0F1SuzREUBH\n=WFf5\n-----END PGP PUBLIC KEY BLOCK-----\n"
        	            	actual  : "-----BEGIN PGP PUBLIC KEY BLOCK-----\nNote: This user hasn't uploaded any GPG keys.\n\n\n=twTO\n-----END PGP PUBLIC KEY BLOCK-----\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,30 +1,6 @@
        	            	 -----BEGIN PGP PUBLIC KEY BLOCK-----
        	            	+Note: This user hasn't uploaded any GPG keys.
        	            	 
        	            	-xsBNBFyy/VUBCADJ7zbM20Z1RWmFoVgp5WkQfI2rU1Vj9cQHes9i42wVLLtcbPeo
        	            	-QzubgzvMPITDy7nfWxgSf83E23DoHQ1ACFbQh/6eFSRrjsusp3YQ/08NSfPPbcu8
        	            	-0M5G+VGwSfzS5uEcwBVQmHyKdcOZIERTNMtYZx1C3bjLD1XVJHvWz9D72Uq4qeO3
        	            	-8SR+lzp5n6ppUakcmRnxt3nGRBj1+hEGkdgzyPo93iy+WioegY2lwCA9xMEo5dah
        	            	-BmYxWx51zyiXYlReTaxlyb3/nuSUt8IcW3Q8zjdtJj4Nu8U1SpV8EdaA1I9IPbHW
        	            	-510OSLmD3XhqHH5m6mIxL1YoWxk3V7gpDROtABEBAAHNGVVzZXIxIDx1c2VyMUBl
        	            	-eGFtcGxlLmNvbT7CwI4EEwEIADgWIQTQEbrYxmXsp1z3j7z9+v0I6RSEHwUCXLL9
        	            	-VQIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRD9+v0I6RSEH22YCACFqL5+
        	            	-6M0m18AMC/pumcpnnmvAS1GrrKTF8nOROA1augZwp1WCNuKw2R6uOJIHANrYECSn
        	            	-u7+j6GBP2gbIW8mSAzS6HWCs7GGiPpVtT4wcu8wljUI6BxjpyZtoEkriyBjt6HfK
        	            	-rkegbkuySoJvjq4IcO5D1LB1JWgsUjMYQJj/ZpBIzVtjG9QtFSOiT1Hct4PoZHdC
        	            	-nsdSgyCkwRZXG+u3kT/wP9F663ba4o16vYlz3dCGo66lF2tyoG3qcyZ1OUzUrnuv
        	            	-96ytAzT6XIhrE0nVoBprMxFF5zExotJD3bHjcGBFNLf944bhjKee3U6t9+OsfJVC
        	            	-l7N5xxIawCuTQdbfzsBNBFyy/VUBCADe61yGEoTwKfsOKIhxLaNoRmD883O0tiWt
        	            	-soO/HPj9dPQLTOiwXgSgSCd8C+LNxGKct87wgFozpah4tDLC6c0nALuHJ0SLbkfz
        	            	-55aRhLeOOcrAydatDp72GroXzqpZ0xZBk5wjIWdgEol2GmVRM8QGbeuakU/HVz5y
        	            	-lPzxUUocgdbSi3GE3zbzijQzVJdyL/kw/KP7pKT/PPKKJ2C5NQDLy0XGKEHddXGR
        	            	-EWKkVlRalxq/TjfaMR0bi3MpezBsQmp99ATPO/d7trayZUxQHRtXzGFiOXfDHATr
        	            	-qN730sODjqvU+mpc/SHCRwh9qWDjZRHSuKU5YDBjb5jIQJivZsQ/ABEBAAHCwHYE
        	            	-GAEIACAWIQTQEbrYxmXsp1z3j7z9+v0I6RSEHwUCXLL9VQIbDAAKCRD9+v0I6RSE
        	            	-H7WoB/4tXl+97rQ6owPCGSVp1Xbwt2521V7COgsOFRVTRTryEWxRW8mm0S7wQvax
        	            	-C0TLXKur6NVYQMn01iyL+FZzRpEWNuYF3f9QeeLJ/+l2DafESNhNTy17+RPmacK6
        	            	-21dccpqchByVw/UMDeHSyjQLiG2lxzt8Gfx2gHmSbrq3aWovTGyz6JTffZvfy/n2
        	            	-0Hm437OBPazO0gZyXhdV2PE5RSUfvAgm44235tcV5EV0d32TJDfv61+Vr2GUbah6
        	            	-7XhJ1v6JYuh8kaYaEz8OpZDeh7f6Ho6PzJrsy/TKTKhGgZNINj1iaPFyOkQgKR5M
        	            	-GrE0MHOxUbc9tbtyk0F1SuzREUBH
        	            	-=WFf5
        	            	+
        	            	+=twTO
        	            	 -----END PGP PUBLIC KEY BLOCK-----
        	Test:       	TestExportUserGPGKeys
=== TestListStopWatches (integrations/user_test.go:230)
=== TestVersion (integrations/version_test.go:18)
=== TestRenderFileSVGIsInImgTag (integrations/view_test.go:15)
=== TestWebfinger (integrations/webfinger_test.go:21)
=== TestXSSUserFullName (integrations/xss_test.go:18)
FAIL
@silverwind
Copy link
Member

silverwind commented Oct 14, 2022

Please reopen, it's still happening a lot:

https://drone.gitea.io/go-gitea/gitea/61581/2/14
https://drone.gitea.io/go-gitea/gitea/61595/2/14

I would consider disabling the test.

@zeripath
Copy link
Contributor

The problem is coming from:

// User1 <user1@example.com>
session := loginUser(t, "user1")
token := getTokenForLoggedInUser(t, session)
testCreateGPGKey(t, session.MakeRequest, token, http.StatusCreated, `-----BEGIN PGP PUBLIC KEY BLOCK-----

Now this sends the a POST request:

func testCreateGPGKey(t *testing.T, makeRequest makeRequestFunc, token string, expected int, publicKey string) {
req := NewRequestWithJSON(t, "POST", "/api/v1/user/gpg_keys?token="+token, api.CreateGPGKeyOption{

This POST request will send the session from line 154 above AND the token.

This is likely to be the cause of the problem.

@silverwind
Copy link
Member

Should be fixed with #21520.

@silverwind
Copy link
Member

Still happening: https://drone.gitea.io/go-gitea/gitea/62401/2/16

@silverwind silverwind reopened this Oct 25, 2022
@garymoon
Copy link
Contributor

Can confirm this continues to happen on 1.17 with the fix applied. It's not obvious to me how this could be a factor, but it only cropped up for us when we started running multiple copies of the pipeline concurrently.

Thanks for working on this everyone 💙

@wxiaoguang
Copy link
Contributor Author

@wxiaoguang wxiaoguang closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2022
@wxiaoguang wxiaoguang added the issue/duplicate The issue has already been reported. label Dec 13, 2022
@lunny
Copy link
Member

lunny commented Dec 13, 2022

Sorry to forget this issue. :(

@wxiaoguang
Copy link
Contributor Author

Never mind, I think the new issue is more helpful. This log in this issue has been out-dated (line number changes a lot indeed)

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/duplicate The issue has already been reported. type/testing
Projects
None yet
Development

No branches or pull requests

5 participants