From da2b0830250206b0c96c4d5976e72f28ce72ed24 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Thu, 27 Mar 2025 09:34:42 -0700 Subject: [PATCH] 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 --- spec/models/ai_tool_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/models/ai_tool_spec.rb b/spec/models/ai_tool_spec.rb index f5751052..0df68dea 100644 --- a/spec/models/ai_tool_spec.rb +++ b/spec/models/ai_tool_spec.rb @@ -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