1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-09 20:17:21 +00:00

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

* previously deleting an already deleted runner returned http 500
* previously any database error for the get endpoint was http 404 and never 500
This commit is contained in:
ChristopherHX
2025-05-16 08:44:29 +02:00
committed by GitHub
parent 7b518bc6c7
commit 59df03b554
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)
})
}