Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

test: stabilize evaluator and SSRF integration coverage (#16468)

Tobias Wochinger37582971f037
diff --git a/web/src/__tests__/server/unstable-evaluator-v2-api.servertest.ts b/web/src/__tests__/server/unstable-evaluator-v2-api.servertest.ts
index bb4a6ddbb5..ee73cdbec8 100644
--- a/web/src/__tests__/server/unstable-evaluator-v2-api.servertest.ts
+++ b/web/src/__tests__/server/unstable-evaluator-v2-api.servertest.ts
@@ -228,11 +228,11 @@ describe("unstable evaluator API on stable evaluator storage", () => {
await Promise.all([
prisma.evaluator.update({
where: { id: older.id },
- data: { createdAt: new Date("2026-01-01T00:00:00.000Z") },
+ data: { updatedAt: new Date("2026-01-01T00:00:00.000Z") },
}),
prisma.evaluator.update({
where: { id: newer.id },
- data: { createdAt: new Date("2026-01-02T00:00:00.000Z") },
+ data: { updatedAt: new Date("2026-01-02T00:00:00.000Z") },
}),
]);
diff --git a/worker/src/__tests__/analyticsIntegrationSsrfPinning.test.ts b/worker/src/__tests__/analyticsIntegrationSsrfPinning.test.ts
index 54e2cc859b..efe440debe 100644
--- a/worker/src/__tests__/analyticsIntegrationSsrfPinning.test.ts
+++ b/worker/src/__tests__/analyticsIntegrationSsrfPinning.test.ts
@@ -135,9 +135,9 @@ vi.mock("../env", () => ({
LANGFUSE_MIGRATION_V4_WRITE_MODE: "legacy",
LANGFUSE_POSTHOG_FLUSH_DELAY_MS: 0,
LANGFUSE_MIXPANEL_FLUSH_DELAY_MS: 0,
- // Must stay non-zero, else the Mixpanel abort timer fires at ~0ms and masks
- // the SSRF block with a spurious timeout error.
- LANGFUSE_MIXPANEL_TIMEOUT_MS: 30_000,
+ // Keep this non-zero so connect-time validation wins the race with the
+ // abort while still bounding the test when the protected request stalls.
+ LANGFUSE_MIXPANEL_TIMEOUT_MS: 1_000,
},
v4WritesToLegacyTables: (e: { LANGFUSE_MIGRATION_V4_WRITE_MODE: string }) =>
e.LANGFUSE_MIGRATION_V4_WRITE_MODE !== "events_only",
@@ -145,6 +145,25 @@ vi.mock("../env", () => ({
e.LANGFUSE_MIGRATION_V4_WRITE_MODE !== "legacy",
}));
+vi.mock("posthog-node", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("posthog-node")>();
+ return {
+ ...actual,
+ PostHog: class extends actual.PostHog {
+ constructor(
+ apiKey: string,
+ options: ConstructorParameters<typeof actual.PostHog>[1],
+ ) {
+ super(apiKey, {
+ ...options,
+ requestTimeout: 1_000,
+ fetchRetryCount: 0,
+ });
+ }
+ },
+ };
+});
+
// Imported after mocks are registered.
import {
handlePostHogIntegrationProjectJob,
@@ -362,7 +381,7 @@ describe("Mixpanel sender — SSRF connect-time pinning", () => {
expect(causeChainIncludes(thrown, "Blocked IP address detected")).toBe(
true,
);
- }, 40_000);
+ }, 5_000);
});
describe("outbound validation classification", () => {