mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-28 18:42:16 +00:00
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:
parent
6827d63e30
commit
da2b083025
@ -160,15 +160,15 @@ RSpec.describe AiTool do
|
|||||||
}
|
}
|
||||||
JS
|
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
|
stub_request(:get, "https://example.com/test").to_return do
|
||||||
sleep 0.01
|
sleep 0.01
|
||||||
{ status: 200, body: "Hello World", headers: {} }
|
{ status: 200, body: "Hello World", headers: {} }
|
||||||
end
|
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
|
result = runner.invoke
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user