-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests(ai-plugins): fix flaky latency assertion (part 2) #13560
Conversation
@@ -1444,7 +1444,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then | |||
first_got.usage.time_per_token = 1 | |||
|
|||
assert.same(first_expected, first_got) | |||
assert.is_true(actual_llm_latency > 0) | |||
assert.is_true(actual_llm_latency >= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is these any possible equal to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This latency is calculated with ngx.now()
and not any monotonic time source, so it's always possible for it to be 0, especially in tests where things are mocked/no actual proxying happens.
kong/kong/llm/drivers/shared.lua
Line 660 in 846f222
kong.ctx.plugin[start_time_key] = ngx.now() |
kong/kong/llm/drivers/shared.lua
Line 718 in 846f222
local llm_latency = math.floor((ngx.now() - kong.ctx.plugin[start_time_key]) * 1000) |
Applies the same fix as 58c580f to similar tests.
5291569
to
b70c138
Compare
Successfully created backport PR for |
Successfully created cherry-pick PR for |
Applies the same fix as 58c580f (#13558) to similar tests.
KAG-5251