test: improve SSE streaming test reliability in CI environment#60
Open
OhYee wants to merge 3 commits intofix-sandbox-ttl-secondsfrom
Open
test: improve SSE streaming test reliability in CI environment#60OhYee wants to merge 3 commits intofix-sandbox-ttl-secondsfrom
OhYee wants to merge 3 commits intofix-sandbox-ttl-secondsfrom
Conversation
Add real HTTP server support for SSE streaming tests to address CancelledError issues with httpx.ASGITransport in CI environments. Update test fixtures to use uvicorn-based servers instead of ASGI transport for more reliable stream handling during integration tests. The changes replace httpx.ASGITransport with actual HTTP servers using uvicorn for testing SSE streams, which resolves premature cancellation problems in CI environments where ASGI transport failed to properly handle streaming responses. 这些更改将 httpx.ASGITransport 替换为使用 uvicorn 的实际 HTTP 服务器来测试 SSE 流, 解决了 CI 环境中 ASGI 传输无法正确处理流式响应导致的提前取消问题。 Change-Id: Ie47a62015e7530b2fd7e027e47e440d2fb3ee453 Signed-off-by: OhYee <oyohyee@oyohyee.com>
Improve test reliability by adding proper error handling when the mock OpenAI server fails to start within the expected timeframe, providing clear error messaging for debugging purposes. 改进测试可靠性,在模拟 OpenAI 服务器无法在预期时间内启动时添加适当的错误处理,提供清晰的错误消息以便调试。 Change-Id: Ibc0fbc8d660dd272da108cd310f91c4393f75087 Signed-off-by: OhYee <oyohyee@oyohyee.com>
Update the mock OpenAI server implementation to properly simulate streaming tool calls with the correct format including tool name, empty arguments, and proper chunk structure that matches real OpenAI streaming responses. The changes modify the streaming test helper to yield tool call information across multiple chunks as expected by the real API format, improving test accuracy and reliability. 更新模拟 OpenAI 服务器实现以正确模拟工具调用的流式传输, 使用与真实 OpenAI 流式响应匹配的格式。修改了流式测试助手, 按真实 API 格式跨多个数据块生成工具调用信息,提高测试准确性和可靠性。 Change-Id: I08f7d64bfc69735ad806ae04e9414c08094c8ed1 Signed-off-by: OhYee <oyohyee@oyohyee.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add real HTTP server support for SSE streaming tests to address CancelledError issues with httpx.ASGITransport in CI environments. Update test fixtures to use uvicorn-based servers instead of ASGI transport for more reliable stream handling during integration tests.
The changes replace httpx.ASGITransport with actual HTTP servers using uvicorn for testing SSE streams, which resolves premature cancellation problems in CI environments where ASGI transport failed to properly handle streaming responses.
这些更改将 httpx.ASGITransport 替换为使用 uvicorn 的实际 HTTP 服务器来测试 SSE 流,
解决了 CI 环境中 ASGI 传输无法正确处理流式响应导致的提前取消问题。
Change-Id: Ie47a62015e7530b2fd7e027e47e440d2fb3ee453
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update