Skip to content

Commit

Permalink
tests(ai-plugins): fix flaky latency assertion (part 2) (#13560) (#13569
Browse files Browse the repository at this point in the history
)

Applies the same fix as 58c580f to similar tests.

(cherry picked from commit a631c3f)

Co-authored-by: Michael Martin <flrgh@protonmail.com>
  • Loading branch information
team-gateway-bot and flrgh authored Aug 23, 2024
1 parent 93b2370 commit e967fe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions spec/03-plugins/38-ai-proxy/02-openai_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,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)
assert.same(actual_time_per_token, time_per_token)
end)

Expand Down Expand Up @@ -1409,7 +1409,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
},
body = pl_file.read("spec/fixtures/ai-proxy/openai/llm-v1-chat/requests/good_multi_modal.json"),
})

-- validate that the request succeeded, response status 200
local body = assert.res_status(200 , r)
local json = cjson.decode(body)
Expand Down Expand Up @@ -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)
assert.same(actual_time_per_token, time_per_token)
end)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
log_message.ai["ai-request-transformer"].usage.time_per_token = 1

assert.same(_EXPECTED_CHAT_STATS, log_message.ai)
assert.is_true(actual_llm_latency > 0)
assert.is_true(actual_llm_latency >= 0)
assert.same(actual_time_per_token, time_per_token)
end)

Expand Down

0 comments on commit e967fe2

Please sign in to comment.