From c186905bb564383c2c5184e8dfac5df329479d4b Mon Sep 17 00:00:00 2001 From: Kong Team Gateway Bot <98048765+team-gateway-bot@users.noreply.github.com> Date: Thu, 17 Oct 2024 03:33:54 +0800 Subject: [PATCH] [cherry-pick -> master] Minor bug fix: Fix error message for `retries` (#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 fc44cb07b09bb714c73c162f8c933e1822a05235) * tests: Update test expectations for retries variable (cherry picked from commit b70ad5f4298bf5e1110d34cbf2568c2b22ca6345) * Update changelog/unreleased/kong/fix-retries-error-message.yml Co-authored-by: Robin Xiang (cherry picked from commit 36b4d6e31ec32cbbfe2002fee7c2fc1a6c1ee361) * Update changelog/unreleased/kong/fix-retries-error-message.yml --------- Co-authored-by: Andy Dawson Co-authored-by: Andy Dawson Co-authored-by: Guilherme Salazar --- changelog/unreleased/kong/fix-retries-error-message.yml | 3 +++ kong/pdk/service.lua | 2 +- t/01-pdk/09-service/04-set-retries.t | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/kong/fix-retries-error-message.yml diff --git a/changelog/unreleased/kong/fix-retries-error-message.yml b/changelog/unreleased/kong/fix-retries-error-message.yml new file mode 100644 index 00000000000..30414532663 --- /dev/null +++ b/changelog/unreleased/kong/fix-retries-error-message.yml @@ -0,0 +1,3 @@ +message: "Fixed an issue where the `retries` error message incorrectly referred to the port." +type: bugfix +scope: PDK diff --git a/kong/pdk/service.lua b/kong/pdk/service.lua index 19620b19283..9264919064f 100644 --- a/kong/pdk/service.lua +++ b/kong/pdk/service.lua @@ -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 diff --git a/t/01-pdk/09-service/04-set-retries.t b/t/01-pdk/09-service/04-set-retries.t index e6687a310a4..ace7ed408dd 100644 --- a/t/01-pdk/09-service/04-set-retries.t +++ b/t/01-pdk/09-service/04-set-retries.t @@ -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]