Repository navigation
Assert what the served endpoints return, not just a 200 - #420
Conversation
|
can you please add the checklist, rebase and run the test one time locally that will help to review the PR after that we can add the |
39d156c to
64a2756
Compare
|
Checklist added to the description, and rebased onto main. Clean, no conflicts, and the diff is unchanged even though On running it locally: |
|
tests are failing with: |
64a2756 to
878349e
Compare
|
Thanks, that log had everything needed. The 400 was the mock engine's own, and the bug is mine. From the run's
The cause is that the endpoint picker is an ext_proc filter, and Envoy strips The mock now decodes a chunked body too. Reproduced and checked locally by running the engine straight out of the manifest:
The suite is 8/8 against the fixed mock, and |
f4f2ac9 to
4da464a
Compare
|
with #473 we updated our test implementation, are you willing to double check the for needed changes ? |
The mock engine answered every chat completion with the same fixed text, never streamed, and treated a body that wasn't JSON as an empty one. So a test could only check that a response came back, not that the caller's request reached the engine intact, that a streamed response survived the gateway as event-stream frames, or that a bad request failed instead of returning a 200. The mock now echoes the last user turn, streams chunk frames ending in [DONE] when the request sets stream, and answers 400 to a body that isn't JSON or carries no messages, as vLLM does. Usage stays fixed, so the metering test's expected record is unchanged. Towards modelplaneai#368. Signed-off-by: Nick Nikolakakis <nonicked@protonmail.com>
The e2e tests check that the InferenceGateway routes a request and rewrites its model, but not what comes back. A gateway that mangled the body, buffered a stream into one response, or turned a bad request into a 200 would pass them. test_serving.py checks the OpenAI and Anthropic response shapes, that the engine sees the caller's last user turn, that a streamed completion arrives as event-stream frames, and that a malformed body, a request without messages, and an unrouted path all fail. Client.request gains raw, to send a body that isn't JSON, and Response gains content_type, which the streaming test needs. Fixes modelplaneai#368. Signed-off-by: Nick Nikolakakis <nonicked@protonmail.com>
4da464a to
22c9ac1
Compare
|
Rebased onto main and rewritten as pytest in |
haarchri
left a comment
There was a problem hiding this comment.
LGTM - thanks for multiple iterations
Fixes #368.
The e2e tests from #482 check that the InferenceGateway routes a request and rewrites its model, but not what comes back. A gateway that mangled the body, buffered a stream into one response, or turned a bad request into a 200 would pass them.
The mock engine now echoes the last user turn, streams
chat.completion.chunkframes ending in[DONE]when a request setsstream, and answers 400 to a body that isn't JSON or has nomessages. Usage stays fixed, sotest_meteringis unchanged. A newe2e/tests/test_serving.pychecks the OpenAI and Anthropic response shapes, the echoed turn, the event-stream frames, and that a malformed body, a request without messages and an unrouted path all fail.Client.requestgainsrawto send a non-JSON body, andResponsegainscontent_typefor the streaming test.This replaces the earlier
unittestsuite ine2e/verify, which #482 superseded. I ran the mock locally against every branch, but not the full two-cluster e2e, so it needs atest-e2erun. The rejection tests assert>= 400rather than an exact status, since the gateway may refuse a malformed body before the engine sees it.I have:
nix flake check(or./nix.sh flake check) and made sure it passes.Added or updated tests covering any composition function changes.This PR changes only the e2e tests and their mock engine.git commit -s.