diff --git a/t/lib/server.lua b/t/lib/server.lua index 603ca2ae6b10..542c6eaef046 100644 --- a/t/lib/server.lua +++ b/t/lib/server.lua @@ -532,7 +532,7 @@ function _M.google_logging_entries() return end - token = string.sub(token, string.len(args_token_type) + 2) + token = string.sub(token, #args_token_type + 2) local verify = jwt:verify(rsa_public_key, token) if not verify.verified then ngx.status = 401 diff --git a/t/plugin/sls-logger.t b/t/plugin/sls-logger.t index c1bce8107d46..fa3e9c43c5cc 100644 --- a/t/plugin/sls-logger.t +++ b/t/plugin/sls-logger.t @@ -167,7 +167,7 @@ hello world local first_idx = string.find(log_entry, " ") + 1 local last_idx2 = string.find(log_entry, " ", first_idx) local rfc3339_date = string.sub(log_entry, first_idx, last_idx2) - local rfc3339_len = string.len(rfc3339_date) + local rfc3339_len = #rfc3339_date local rfc3339_millisecond = string.sub(rfc3339_date, rfc3339_len - 4, rfc3339_len - 2) return tonumber(rfc3339_millisecond) end