FIX: attempt to fix flaky (#1226)

The AI Tool spec that checks that the tool runner will not timeout on slow HTTP request is flaky. In this PR we attempt to resolve the flakiness by:

Ensuring stub_request runs before the request
Increasing the timeout for CI env
This commit is contained in:
Keegan George 2025-03-27 09:34:42 -07:00 committed by GitHub
parent 6827d63e30
commit da2b083025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -160,15 +160,15 @@ RSpec.describe AiTool do
}
JS
tool = create_tool(script: script)
runner = tool.runner({ "query" => "test" }, llm: nil, bot_user: nil, context: {})
stub_request(:get, "https://example.com/test").to_return do
sleep 0.01
{ status: 200, body: "Hello World", headers: {} }
end
runner.timeout = 5
tool = create_tool(script: script)
runner = tool.runner({ "query" => "test" }, llm: nil, bot_user: nil, context: {})
runner.timeout = 10
result = runner.invoke