1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-06 02:27:20 +00:00

Fix get / delete runner to use consistent http 404 and 500 status (#34480) (#34488)

Backport #34480 by @ChristopherHX

* previously deleting an already deleted runner returned http 500
* previously any database error for the get endpoint was http 404 and
never 500

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
Giteabot
2025-05-17 00:59:29 +08:00
committed by GitHub
parent a0e272d95a
commit 21731c1370
2 changed files with 35 additions and 18 deletions

View File

@ -329,4 +329,12 @@ func testActionsRunnerRepo(t *testing.T) {
req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/user2/repo1/actions/runners/%d", 34349)).AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
})
t.Run("DeleteAdminRunnerNotFoundUnknownID", func(t *testing.T) {
userUsername := "user2"
token := getUserToken(t, userUsername, auth_model.AccessTokenScopeWriteRepository)
// Verify delete a runner by unknown id is not found
req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/user2/repo1/actions/runners/%d", 4384797347934)).AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
})
}