Skip to content

Commit

Permalink
[cherry-pick -> master] Minor bug fix: Fix error message for retries (
Browse files Browse the repository at this point in the history
#10433)

* fix: Correct error message for retries variable

The variable being tested is retries, but the error message refers to
port.

(cherry picked from commit fc44cb0)

* tests: Update test expectations for retries variable

(cherry picked from commit b70ad5f)

* Update changelog/unreleased/kong/fix-retries-error-message.yml

Co-authored-by: Robin Xiang <[email protected]>
(cherry picked from commit 36b4d6e)

* Update changelog/unreleased/kong/fix-retries-error-message.yml

---------

Co-authored-by: Andy Dawson <[email protected]>
Co-authored-by: Andy Dawson <[email protected]>
Co-authored-by: Guilherme Salazar <[email protected]>
  • Loading branch information
4 people authored Oct 16, 2024
1 parent 91c762f commit c186905
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-retries-error-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "Fixed an issue where the `retries` error message incorrectly referred to the port."
type: bugfix
scope: PDK
2 changes: 1 addition & 1 deletion kong/pdk/service.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ local function new()
error("retries must be an integer", 2)
end
if retries < 0 or retries > 32767 then
error("port must be an integer between 0 and 32767: given " .. retries, 2)
error("retries must be an integer between 0 and 32767: given " .. retries, 2)
end

local ctx = ngx.ctx
Expand Down
4 changes: 2 additions & 2 deletions t/01-pdk/09-service/04-set-retries.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ retries must be an integer
--- request
GET /t
--- response_body
port must be an integer between 0 and 32767: given -1
port must be an integer between 0 and 32767: given 32768
retries must be an integer between 0 and 32767: given -1
retries must be an integer between 0 and 32767: given 32768
--- no_error_log
[error]
Expand Down

0 comments on commit c186905

Please sign in to comment.