test: relax live web search timeouts

This commit is contained in:
Peter Steinberger
2026-04-29 19:13:39 +01:00
parent 39ecedb300
commit 4bc79f9737
2 changed files with 10 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import { createKimiWebSearchProvider } from "./src/kimi-web-search-provider.js";
const KIMI_SEARCH_KEY =
process.env.KIMI_API_KEY?.trim() || process.env.MOONSHOT_API_KEY?.trim() || "";
const describeLive = isLiveTestEnabled() && KIMI_SEARCH_KEY.length > 0 ? describe : describe.skip;
const KIMI_LIVE_SEARCH_TIMEOUT_SECONDS = 60;
function isTransientKimiSearchError(error: unknown): boolean {
if (!(error instanceof Error)) {
@@ -22,7 +23,11 @@ describeLive("moonshot plugin live", () => {
const provider = createKimiWebSearchProvider();
const tool = provider.createTool?.({
config: {},
searchConfig: { kimi: { apiKey: KIMI_SEARCH_KEY }, cacheTtlMinutes: 0, timeoutSeconds: 20 },
searchConfig: {
kimi: { apiKey: KIMI_SEARCH_KEY },
cacheTtlMinutes: 0,
timeoutSeconds: KIMI_LIVE_SEARCH_TIMEOUT_SECONDS,
},
} as never);
let result: { provider?: string; content?: unknown; citations?: unknown } | undefined;
@@ -47,5 +52,5 @@ describeLive("moonshot plugin live", () => {
expect(typeof result?.content).toBe("string");
expect((result?.content as string).length).toBeGreaterThan(20);
expect(Array.isArray(result?.citations)).toBe(true);
}, 60_000);
}, 180_000);
});

View File

@@ -11,6 +11,7 @@ import { createWebSearchTool } from "./tools/web-search.js";
const XAI_KEY = process.env.XAI_API_KEY ?? "";
const LIVE = isLiveTestEnabled(["XAI_LIVE_TEST"]);
const XAI_WEB_SEARCH_LIVE_TIMEOUT_SECONDS = 60;
const describeLive = LIVE && XAI_KEY ? describe : describe.skip;
@@ -133,6 +134,7 @@ describeLive("xai live", () => {
web: {
search: {
provider: "grok",
timeoutSeconds: XAI_WEB_SEARCH_LIVE_TIMEOUT_SECONDS,
grok: {
model: "grok-4-1-fast",
},
@@ -165,5 +167,5 @@ describeLive("xai live", () => {
(Array.isArray(details.citations) ? details.citations.length : 0) +
(Array.isArray(details.inlineCitations) ? details.inlineCitations.length : 0);
expect(citationCount).toBeGreaterThan(0);
}, 45_000);
}, 90_000);
});